Friday, July 8, 2022
Oracle fun without dba privileges
Wednesday, November 10, 2021
How to download Elastic plugins
There's no searchable answer for this, so I hope mine finds its way into an index somewhere.
How do you download Elasticsearch plugins?
How do you download Elastic plugins directly?
How download Elastic plugin proxy?
Where Elastic plugin repo argh?
Simple answer: There's a download link on each plugin page.
For example, there's a link to the current artifact in the middle of the Analysis-SmartCN page. which is listed on the Plugins and Integrations page.
It's obnoxious. It's the last place you'd look if you're not handcrafting this stuff. But at least now you can stop using elasticsearch-plugin to download these things into a dummy instance.
Here are the four plugins you need to use ES 7.15 with Liferay 7.2 or 7.3.
To install, use the file:// parameter, e.g.,
elasticsearch-plugin install file:///path/to/zip
Monday, August 23, 2021
Not Unixish: Scanning with the Canon MF4770n and OS 10.14
I just had a rather infuriating half-hour. Here's how to enable network scanning from MacOS 10.14 to a Canon MF4770n printer.
First, disregard the official Canon documentation. Disregard it as hard as you can.
- Go to the device's download page.
- The download page may autodetect "Mac OS X" and say no files are available. Select MacOS 10.14 instead. There are two; pick the one with more files under it.
- Download and install the scan utility, currently mac-scan-2158.dmg . It includes the driver and some utilities.
- Take a moment to visit the printer and make sure the benighted thing has a valid IP.
- Open System Preferences -> Printers. Add the printer, hopefully via Bonjour. This isn't Windows, so Autodetect will find the driver.
- In System Preferences -> Printers, the MF4770n has Print and Scan tabs above its picture. Select Scan.
- On the printer, lay out your document and click the Scan button. Then choose "Remote Scanner". The Send-To option is tempting, but doesn't work for me.
- Back in System Preferences, click "Open Scanner". The scanner will automatically do an overview. By default, it'll attempt to identify separate items.
- Once the overview is complete, press Scan. If you disabled Auto Selection, you'll be required to select an area. By default, images go to the Pictures folder.
If you receive error code 2100010, it probably means the scanner isn't listening in Remote Scanner mode.
If the scanner doesn't show up after adding the printer in SysPref, MF Toolbox may help.
- Open MF Toolbox, which was installed by the driver dmg. Ignore any warnings about not finding a scanner.
- Under MF Toolbox -> Network Scanner settings, add the printer. Hopefully it shows up over Bonjour; I haven't tried IP.
- Close MF Toolbox; you're done with it.
- Scan using SysPref as described above.
H/T to Darius in the Canon forum for showing that the official docs are wrong, and Nidhish on FixYa for demystifying the printer menu.
Monday, August 13, 2018
Bottle shaking: Reset Mac's SMC and PRAM
On the off chance it works, these are the dance steps.
- SMCShut down. Hold ctrl-option-power. Watch for the power adapter to flash green. (Obvs, it helps if the charge LED is orange when you start. If it's green, I guess it still flashes.
The machine remains powered down. - PRAM While shut down, hold ⌘-option-p-r-power. When it starts to come up, let go of the power button.
Continue holding the other buttons through three reset cycles, marked by the default startup sound.
After the third startup sound, let go of the buttons and allow the machine to start up as usual.
Thursday, December 21, 2017
A much easier way to ream out an Oracle schema
set heading off
set pagesize 0
select 'drop '||object_type||' '|| object_name|| DECODE(OBJECT_TYPE,'TABLE',' CASCADE CONSTRAINTS','') || ';' from user_objects;
purge recyclebin;
select * from user_objects
Thursday, January 26, 2017
No, you can't edit Font Book collections
![]() |
These are not the options you're looking for. Move along.
|
There's a simple workaround: The collections themselves can be deleted. Rename the contaminated collection and create an empty one with the desired name. Move all the stuff you actually want into the new collection, then delete the renamed contaminated collection via the File menu.
I fully acknowledge that this is going to be useful to precisely nobody I know. Maybe Hugh. I'm just posting it in the vain hope that it will short-circuit the next person's fruitless search for a nonexisting feature.
Friday, November 25, 2016
Editing cells in SQL Developer
But there's a better way!
- Find the offending cell using the query worksheet, then copy the WHERE clause.
- In the query, hold down ⌘ (Ctrl on Windows) while mouse hovering over the table name. The table name becomes a link.
- Click on that link. (Once you know about this behavior, you can ⌘-click without hovering.)
- Now you're in the data grid for the selected table. Paste the WHERE clause from your buffer and hit Enter.

- Double click on any record to edit it, or right-click on the row to use Single Record View.
- YOU WIN. EVERYBODY WINS.
- In the connections browser, expand the schema.
- Expand Tables.
- Scroll, scroll, scroll down to the desired table. Wait, you missed it. Scroll back up.
- Click on the table name. This opens the data grid, as in step 4 above.
h/t That Jeff Smith
Monday, March 2, 2015
Check when your password will expire
It turns out that chage, which I had thought was really only useful for root, provides a way for non-root users to check their own accounts.
somesrvr kexline@somesrvr ~
$chage -l kexline
Last password change : Mar 02, 2015
Password expires : Mar 06, 2015
Password inactive : never
Account expires : never
Minimum number of days between password change : 0
Maximum number of days between password change : 4
Number of days of warning before password expires : 2
Friday, July 11, 2014
Oracle password expiry without DBA privs
SQL> select * from user_password_limits;
RESOURCE_NAME LIMIT
-------------------------------- ----------------------------------------
FAILED_LOGIN_ATTEMPTS 10
PASSWORD_LIFE_TIME 180
PASSWORD_REUSE_TIME UNLIMITED
PASSWORD_REUSE_MAX UNLIMITED
PASSWORD_VERIFY_FUNCTION NULL
PASSWORD_LOCK_TIME 1
PASSWORD_GRACE_TIME 7
7 rows selected.
SQL> select account_status,expiry_date from user_users;
ACCOUNT_STATUS EXPIRY_DA
-------------------------------- ---------
OPEN 03-JAN-15
At some point, I need to collect all my DBA-free Oraclejitsu into a single document. But I say the same thing to that that I say to death: "Not today."
Wednesday, April 2, 2014
Shell one-liner: Get your effective Ghostscript path
Ghostscript's helpfile mentions its font path. However, it's not presented in a usable format, and worse, it includes directories that don't exist. This cleans it up and spits it back out in a format that you can paste into a path configuration.
Saturday, March 29, 2014
Destroy a schema from the inside
This is a VERY rough recipe that I just wrote for a coworker. It assumes you have Oracle SQLDeveloper and a shell handy.
- sql> select /*csv*/ 'DROP ',user_objects.object_type,' ',user_objects.object_name from user_objects where object_type in ('INDEX','TABLE');
- F5 (run as script)
- Select everything in your output window and copy it to /tmp/objects
- bash> cat /tmp/objects | grep -v OBJECT_NAME | sed s/\"//g | sed s/\,//g | sed s/$/\;/ > /tmp/drop.sql
- In SQLNavigator, clear your query and output screens (pencil eraser)
- File -> Open /tmp/drop.sql
- F5 (run as script) -- drops may cascade, which will cause errors later in the script; ignore
- sql> purge recyclebin;
- sql> select * from user_objects; -- should return 0 rows now.
Thursday, January 30, 2014
Awk: Print all but the last field
awk -F/ '{$NF=""; print $0}' filename
i.e., you set the Nth field to null, then print the modified item. You can do that with other fields as well -- $1, $(NF-1), and so on.
But that changes all the slashes to spaces. I knew there were no spaces in my list, so I fixed it with sed:
awk -F/ '{$NF=""; print $0}' filename | sed s/\ /\//g
I could also have used the OFS (output field separator) directive in awk, but that doesn't work within a one-liner.
awk -F/ 'BEGIN { OFS = "/"}{ $NF=""; print $0 }' filename
You can also edit the output record separator the same way -- for example, if you're sedawking a batch script, perhaps you want to add semicolons.
awk -F/ 'BEGIN { OFS = "/"; ORS=";\n"}{ $NF=""; print $0 }' filename
(h/t One Tip Per Day and GNU)
Thursday, August 8, 2013
Newbie help: Finding yourself (assuming you're a script)
myname = `basename $0`
Why basename $0? If you think about handling arguments in shell scripts, you'll recall that the first argument is $1, the second is $2, and so on. So the full pathname of the script is the zeroth argument. Basename simply strips that string down to the filename.
To do the same thing, but get the containing directory instead, use
mydir = `dirname $0`
Easy enough.
Unfortunately, $0 only gives you the path of the script as it was run. So if we do this:
cd /opt/somedir
./subdir/script.sh
then dirname $0 will only return ./subdir . That's not useful if we need to change directories during the course of script.sh without losing track of where we started.
Here's the solution:
SCRIPTPATH=$( cd "$(dirname "$0")" ; pwd -P )
Spawn a subshell, cd into the directory using the relative or absolute path from dirname $0, and then print the working directory of the subshell. This version resolves symlinks; omit the -P to preserve them.
Wednesday, May 8, 2013
Newbie help: find basics
Find has built-in actions, such as delete, ls, print[ to file], and exec[ute-another-command]. You can also pipe the output into other commands. I'll cover actions in a later post.
Basic syntax:
find path -constraint value
Add as many constraints as you like. Any flag can be negated with a bang; see the very last examples for the syntax.
The most common constraints are size, and modified date (-mtime). Both of these flags can serve as an upper or lower bound.
Example: Which files below the current directory are less than five days old and more than 5kb? Which are more than five days old and less than 5kb?
find . -mtime -5 -size +5000
find . -mtime +5 -size -5000
The -type flag allows you to specify whether you're looking for files or directories. By default, find returns both. Depending on your OS, the values will be either "f" or "file", and either "d" or "dir". Check man for details.
The -name flag can take a full case sensitive filename, or a regex pattern. If you use a pattern, enclose it in double quotes.
find /app -name applog
find /app -name "*log"
find . -name "*dunno*"
find . -name "[j,J]ava*"
Find can also identify files owned by a specific user or group. (This flag is available on OS X, but doesn't appear to work.)
find /tmp -user kexline
Combine flags to ask real-world questions about your files. Example: What largish, non-gzipped files did I create in my application directory since this time yesterday?
find /app -type f -mtime -1 -user kexline -size +100000 ! -name "*gz"
As promised, there's a bang negation. Any flag can be prepended with a bang to reverse its meaning. What files did all the other non-root users create yesterday, anywhere on the machine?
sudo su
find / -type f -mtime -1 ! -user kexline ! -user root
Newbie help: The "locate" command
Newbie help: Is this file in use?
You can use "fuser" to check whether any processes have a file open.
$ fuser somefile
somefile: 20719
$ fuser anotherfile
$
Pid 20719 is using somefile, but nothing is using anotherfile.
Pipe queen bonus: I want to compress some old stuff in a directory. Here are some big files:
$du -sk ./* | sort -n | tail -5
71796 ./applog.20120418.gz
349252 ./applog
422952 ./applog.20120613
598672 ./applog.20120627
2816980 ./applog.20130204
Which of the largest five files are in use, if any?
$du -sk ./* | sort -n | tail -5 | awk '{print $2}' | xargs fuser
./applog: 44827
Pid 44827 is using the current applog. The last three are safe to compress.
(Tangent: Compression generally writes to the current filesystem. Therefore, you can't compress in a filesystem that's 100% full.)
Newbie help: Why is my filesystem full?
If you haven't already, use df to make sure you know which filesystem is full. Many systems only have one filesystem, but it's more common to have a few. For the purpose of this discussion, you're only concerned about files below the mount point of one overutilized filesystem.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgroot 30G 3.6G 25G 13% /
tmpfs 1.9G 4.0K 1.9G 1% /dev/shm
/dev/mapper/vgapp 20G 6.7G 13G 96% /app
nfssrv:/vol/devshare 10G 192K 10G 1% /app/dshare
nfssrv:/export/home/fred
102G 90G 12G 89% /home/fred
cd to the mount point or a point in the directory tree where you suspect things might have gone awry, then do this:
du -sk ./* | sort -n
In English, that's "disk usage -specific_file -kilobytes, then sort -numeric." These flags will be the same on any *nix.
Non-root users will receive a lot of "Permission denied" errors when running this command in system or shared directories. This can be a good thing; if you're interested in finding files created by a certain user, the errors show you where not to look. On the other hand, if you're really in the dark and/or troubleshooting a multiuser system, you may need to become root.
You can use du to identify the largest directories, which may help you find your problems.
An example:
$cd /app
$ls -atlr
total 8167528
dr-xr-xr-x. 30 root root 4096 Mar 20 03:51 ..
drwxr-xr-x. 7 lruser lrgrp 4096 Mar 26 20:04 common
drwxrwxr-x. 9 lruser lrgrp 1490944 Apr 23 16:24 .
drwxr-xr-x. 16 lruser lrgrp 4096 May 1 16:52 calendar
drwxr-xr-x. 14 lruser lrgrp 4096 May 7 18:16 liferay
Not much help, right? But du makes it easy to decide where to look first.
$du -sk ./* | sort -n
644116 ./common
1563248 ./calendar
8613876 ./liferay
So the Liferay directory's pretty chubby. Why is that?
$cd liferay
$du -sk ./* | sort -n
0 ./jdk-liferay
4 ./deploy
520884 ./data
1092408 ./logs
1232588 ./backup
5492700 ./appserver
Unsurprisingly, the JVM accounts for most of Liferay's 8gb. I should also look for things to delete from the backup directory, but let's stick with the big fish for now.
$cd appserver
$du -sk ./* | sort -n
...
149408 ./temp
419056 ./web
4759364 ./logs
And again unsurprisingly, the logs directory accounts for most of the JVM's utilization. Du works on files as well, so you could use it to quickly find the largest file in a directory.
$cd logs
$du -sk ./* | sort -n
54340 ./applog.20121001.gz
71796 ./applog.20120418.gz
349252 ./applog
422952 ./applog.20120613
2816980 ./applog.20130204
Wait, I'm lazy. How big was that last file?
$ls -lh applog.20130204
-rw-r--r--. 1 lruser lrgrp 2.7G Feb 4 16:55 applog.20130204
Many commands that show file sizes, such as df, du, and ls, have a -h (-human_readable) flag. We use du -k because the -h output is not easily sortable.
If you haven't freed enough space or found your culprit, pick another place in the tree and du down from there.
Friday, September 18, 2009
How to enable kernel dumps on RH4
http://www.nocrack.fr/?p=24
Monday, June 22, 2009
Fixing X11 on Red Hat
NVidia has tips here, but they are predicated on running modprobe nvidia. When I did that, modprobe and rmmod reported that the nvidia driver was not present in /proc/modules.
The fix for my machine:
- Run nvidia-installer --update
- OR, Run nvidia-installer-latest to get the FTP URL for the latest nvidia driver.
- Download same using wget. (Cut & paste may work.)
- OR, Run nvidia-installer-latest to get the FTP URL for the latest nvidia driver.
Tuesday, March 24, 2009
Extending a swap LVM in Redhat 4 or 5
- lvscan
- lvextend --size +4G /dev/someVG/someVol
- lvscan
- free -m
- swapoff
- mkswap /dev/someVG/someVol
- swapon -va
- free -m

