Posts

Buffalo LinkStation Time Machine 'File In Use' error

For some reason, it seems that afpd running on my LinkStation keeps some kind of lock open on the sparsebundle from Time Machine even when my Mac disconnects from the share I have setup. So, I figure the best solution would be to restart afpd once per night. Make sure your time is in sync (turn on NTP via the web interface). Verify the current timezone is correct. (The web interface has a lot less choices than what are provided by the linux distribution). ls -la /etc/localtime The output will show you what timezone file you are pointing to. If it is wrong, you can change it. ls /usr/share/zoneinfo/America The output will show the available timezones. To replace yours with a new one 'ln -sf /usr/share/zoneinfo/America/[zone_file_name] /etc/localtime' Edit your crontab: 'vi /etc/cron/crontabs/root' Figure out when you want to run the command via:  https://crontab.guru/ I wanted to restart afpd at 2:00 AM, so I added this line to my crontab: '0 2 * * *...

Dump Mongo Indexes to Re-playable Script

When using mongo, we at times create indexes in our production environment to support slow queries and need to bring those indexes back into other environments for testing and consistency. I have not found anything similar, but this script dumps the mongo indexes to output for every collection in every database that way this output can be run against mongo to create them. Enjoy! db = db.getSiblingDB('admin'); var dbs = db.runCommand({ 'listDatabases': 1 }).databases; var result = ''; dbs.forEach(function(database) { if(database.name !== 'admin' && database.name !== 'local' && database.name !== 'system') { result += 'db = db.getSiblingDB(\"' + database.name + '\");\n\n'; db = db.getSiblingDB(database.name); db.getCollectionNames().forEach(function(collection) { if(collection !== 'system.users') { indexes = db[collection].getIndexes(); ...

Disable Raspberry Pi Screen Blanking

I've come across a couple solutions to disable the screen going to sleep on the Raspberry Pi. There are a few 'xset' commands out there but I found they never worked. Instead I tried this solution: sudo nano /etc/lightdm/lightdm.conf In that file, look for: [SeatDefault] and insert this line: xserver-command=X -s 0 dpms

JSON Transformation via XML and XSLT (JsonXslt)

Recently, I tried to look for a way to transform JSON to another JSON object. Surprisingly, I did not find anything like this. I'm pretty familiar with XSLT, so I figured that could be a good way to transform between JSON objects. So, I created my first public github project:  https://github.com/kuhnboy/JsonXslt . This project provides currently two classes: 1) JsonXPathNavigator (either used with XsltCompiledTransform to use as the source of an XSLT transformation or can be loaded into an XDocument or XmlDocument via the ReadSubtree method). 2) XmlJsonReader (subclass of the Newtonsoft JsonReader, allowing you to load an XDocument into a JObject via JObject.Load). Of course there are a few limitations because JSON and XML are quite different, but it's a start. You should be able to do things like convert JSON -> HTML via XSLT. Edit: The JsonXslt package is currently available on NuGet and I have added a JSON -> HTML example on GitHub.

Remove hidden files generated by Mac OS Finder

I've had a number of solutions during the years for removing hidden files that show up in DOS based systems such as the DS_STORE and resource forks. Traditionally, I've removed them with a recursive shell 'rm' command. I did not know about this command though: dot_clean You can use it like this: sudo dot_clean -m /Volumes/NAME_OF_DISK This should go and remove any Trashes, Spotlight, or Finder files that are stored on the drive.

Install ipkg on Buffalo Linkstation 421e

Login to the NAS via SSH as root Run the following: wget http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/teraprov2-bootstrap_1.2-7_arm.xsh sh teraprov2-bootstrap_1.2-7_arm.xsh Now, run 'ipkg update' to update the list of packages available Run 'ipkg list' to list the packages available to install

Enable Buffalo LinkStation 421e SFTP

Kind of as an update to my  Gain SSH access to the Buffalo LinkStation 421e  article, I realized SFTP support wasn't setup correctly. In order to do this, I had to: SSH into the LinkStation. If you haven't enabled SSH access,  here's how . vi /etc/sshd_config On the line that starts with Subsystem, replace /usr/local/libexec/sftp-server with /usr/lib/sftp-server. Save and quit vi. Run: /etc/init.d/sshd.sh restart That's it.