This file contains 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
#include <stdlib.h> | |
#include <string.h> | |
#include <limits.h> | |
#include <stdio.h> | |
const char * | |
bitap_fuzzy_search (const char *text, const char *pattern, int errors) | |
{ | |
const char *result = NULL; | |
int m = strlen (pattern); |
This file contains 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
#include <glib.h> | |
#include <gst/gst.h> | |
// Compile with: gcc hello.c `pkg-config gstreamer-0.10 --libs --cflags` | |
static gboolean | |
bus_call (GstBus *bus, GstMessage *msg, gpointer data) | |
{ | |
GMainLoop *loop = (GMainLoop *) data; | |
switch (GST_MESSAGE_TYPE (msg)) |
This file contains 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 'rubygems' | |
require 'activemerchant' | |
ActiveMerchant::Billing::Base.mode = :test | |
paypal_options = { | |
:login => 'xxx', | |
:password => 'yyy', | |
:signature => 'zzz' | |
} | |
::PAYPAL_EXPRESS_GATEWAY = ActiveMerchant::Billing::PaypalExpressGateway.new(paypal_options) |
This file contains 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
COUNTRIES = { | |
'AF' => 'Afghanistan', | |
'AL' => 'Albania', | |
'DZ' => 'Algeria', | |
'AS' => 'American Samoa', | |
'AD' => 'Andorra', | |
'AO' => 'Angola', | |
'AI' => 'Anguilla', | |
'AQ' => 'Antarctica', | |
'AG' => 'Antigua and Barbuda', |
This file contains 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 'digest/sha2' | |
def ssid_to_sn(ssid_number) | |
key = ssid_number[0..1] | |
if SN_TABLE[key] | |
sn_part_1 = SN_TABLE[key][0] | |
k = SN_TABLE[key][1] | |
q = SN_TABLE[key][2] | |
sn_part_2 = ((ssid_number.to_i - q) / k).to_i | |
return "#{sn_part_1}X#{'%.7i' % sn_part_2}" |
This file contains 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 'readline' | |
loop do | |
line = Readline::readline('> ') | |
break if line.nil? || line == 'quit' | |
Readline::HISTORY.push(line) | |
puts "echo: #{line}" | |
end |
This file contains 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
kill `ps ax | grep -v grep | grep -e "unicorn_rails .*-p 3000" | awk 'NR==1{print $1}'` |
This file contains 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 'zip/zip' | |
module Zip | |
def self.create(filename, *files) | |
Zip::ZipFile.open(filename, Zip::ZipFile::CREATE) do |zip| | |
files.each { |file| add(zip, file) } | |
end | |
end |
This file contains 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 'Qt' | |
require 'qtwebkit' | |
class Viewer < Qt::WebView | |
slots 'change_h1()' | |
def initialize(parent = nil) | |
super(parent) | |
connect(self, SIGNAL('loadFinished(bool)'), self, SLOT('change_h1()')) |
This file contains 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
typedef unsigned long long bboard; // 64 bit unsigned integer | |
bboard | |
get (bboard b, int square) | |
{ | |
return (b & (1ULL << square)); | |
} |