This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "fileutils" | |
# === PSDB Packed Stats Database | |
# | |
# This is a small journaling multi process aware database for counting choises. | |
# | |
# === Authors | |
# * dpree | |
# * threez | |
class PSDB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "ffi" | |
module Mount | |
class Fstab < FFI::Struct | |
layout :fs_spec, :string, # block special device name | |
:fs_file, :string, # file system path prefix | |
:fs_vfstype, :string, # File system type, ufs, nfs | |
:fs_mntops, :string, # Mount options ala -o | |
:fs_type, :string, # FSTAB_* from fs_mntops | |
:fs_freq, :int, # dump frequency, in days |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'drb/drb' | |
p DRb.start_service("druby://localhost:0") | |
server = DRbObject.new_with_uri("druby://::1:5000") | |
p server | |
p server.foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'Exim Config' do | |
let!(:exim) { exim_server(config) } | |
context 'simple config' do | |
let!(:relay) { mail_server(:y) } | |
let(:config) { exim_config(:simple) } | |
let(:mail_x) { mail_fixture(:mail_x) } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open3' | |
require 'fileutils' | |
USER = 'XXX | |
CMD = '/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog' | |
MUSIC_LOCATION = "/Users/#{USER}/Music/iTunes/iTunes Music/" | |
TARGET_DIR = "/Users/#{USER}/Musik MP3" | |
# start cocoa dialog for progress bar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Message < Struct.new(:type, :payload) | |
REQUEST = ?<.freeze | |
RESPONSE = ?>.freeze | |
HEADER = 'NA'.freeze | |
CODER = Marshal | |
def self.request(payload) | |
new(REQUEST, payload) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HTTPParser = process.binding('http_parser').HTTPParser; | |
var parser = require("http").parsers.alloc(); | |
parser.reinitialize(HTTPParser.RESPONSE); | |
parser.onBody = function(body) { | |
console.log(body.toString()); | |
} | |
parser.onIncoming = function(response) { | |
console.log(response.headers); | |
console.log(response.statusCode); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LDAP_SERVER=example.com:636 | |
ALIAS=LDAP_SERVER | |
KEYSTORE=/usr/lib/jvm/java-1.6.0-openjdk-amd64/jre/lib/security/cacerts | |
PASSWD=changeit | |
# grep the certificate | |
echo -n | openssl s_client -connect $LDAP_SERVER | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ldaps.crt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
var WebSocketClient = require('websocket').client, | |
client = new WebSocketClient(), | |
url = 'ws://localhost:8080/', | |
light = '11011C'; | |
function handleMessage(connection, data) { | |
var now = new Date(); | |
// door was opened turn on the light | |
if (data['door-opened']) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usb/bin/env ruby | |
require 'fiddle' | |
require 'fiddle/import' | |
require 'pp' | |
module Sqlite3 | |
SQLITE_OK = 0 | |
module Driver | |
extend Fiddle::Importer |