Skip to content

Instantly share code, notes, and snippets.

@lukhnos
lukhnos / encfs-on-ec2.md
Last active April 23, 2018 12:32
Installing encfs on an Amazon EC2 instance

encfs is not available on the default yum repository (I run a micro instance), but it's in the Extra Packages for Enterprise Linux (EPEL) repository. See Amazon's own FAQ on enabling that repository, then all you need is to run yum:

sudo yum install fuse-encfs

As of writing this installs encfs 1.7.4 for you. It's hassle-free, and so it's good.

@lukhnos
lukhnos / encfs-on-darwin-13.md
Last active January 3, 2016 07:39
Installing encfs 1.7.5 on OS X 10.9

Currently it's not possible to install encfs on OS X 10.9 using MacPorts (not without manually changing the portfile at least). You can try Brew, although I don't use it.

Here's how I installed it:

  1. Do sudo port install encfs. This will fail in the last step, and it's ok – the point is to have port install the dependencies for you

  2. Check out the latest stable version of encfs:

    svn co http://encfs.googlecode.com/svn/branches/1.x encfs-1.x
    
  3. Change to encfs-1.x, run:

@lukhnos
lukhnos / OpenVanilla-Info.plist
Created January 27, 2013 03:47
A patch to OpenVanilla's Info.plist to allow CrossOver to use the input method toolset. This is actually a bug of CrossOver – it cannot activate any input method with no input modes. This works around the bug. This is for OpenVanilla 1.0.6.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12C60</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>OpenVanilla</string>
@lukhnos
lukhnos / mcbopomofo-parser.dot
Created November 1, 2012 05:13
DFA for parsing McBopomofo data.txt (Graphviz)
# Parser DFA for McBopomofo's data.txt
#
# Regular expression equivalent:
#
# (\n*\w\w*\s\w\w*\s\w\w*)*$
#
digraph finite_state_machine {
rankdir = LR;
size = "10";
@lukhnos
lukhnos / pbkdf2test.c
Created July 19, 2012 05:25
An example of using CommonCrypto's PBKDF2 function
// an example of using CommonCrypto's PBKDF2 function
//
// build with:
//
// clang -o pbkdf2test pbkdf2test.c
//
// test with:
//
// ./pbkdf2test <some plaintext password here>
@lukhnos
lukhnos / gist:2892699
Created June 8, 2012 00:45
Enumerate all available keyboard layouts on Mac OS X and write out their icons
// need to include <Carbon/Carbon.h> and link against Carbon.framework
// not every layout/input method has TIFF icon
CFArrayRef list = TISCreateInputSourceList(NULL, true);
for (int i = 0; i < CFArrayGetCount(list); i++) {
TISInputSourceRef source = (TISInputSourceRef)CFArrayGetValueAtIndex(list, i);
IconRef icon = TISGetInputSourceProperty(source, kTISPropertyIconRef);
CFStringRef sourceID = TISGetInputSourceProperty(source, kTISPropertyInputSourceID);
@lukhnos
lukhnos / curry2.m
Created February 8, 2012 18:09
Using Objective-C block to curry a function, take 2
#include <stdio.h>
int f(int x, int y)
{
return x + y;
}
int main()
{
@lukhnos
lukhnos / curry1.m
Created February 8, 2012 18:08
Using Objective-C block to curry a function, take 1
#include <stdio.h>
int f(int x, int y)
{
return x + y;
}
int main()
{
@lukhnos
lukhnos / To-the-lo.txt
Created December 25, 2011 01:14
A POJ transcription of the Taiwanese classic "Tò-thè lo" (倒退嚕) and tentative English translation
# Tò-thè lo (倒退嚕; Sauntering Backwards)
* By N̂g Khek-lîm (黃克林; Mandarin: Huang Ke-lin)
* http://www.youtube.com/watch?v=mPRtVb0s81c
嘿 拜請拜請
拜請 東海岸 西海岸
北投紗帽山
鶯歌出土炭
草山出溫泉
@lukhnos
lukhnos / Graph.m
Created March 15, 2011 04:52
The original Objective-C as shown in Brad Cox's book "Object-Oriented Programming: An Evolutionary Approach" (1986). Note the differences from the present-day version.
// Dependency graph
#include "objc.h"
extern id Node;
= Graph:Set { }
// Add a new node
- addNode:(STR)aCharPointer
{ return [self filter:[Node str:aCharPointer]]; }