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 'readline' | |
| loop do | |
| line = Readline::readline('> ') | |
| break if line.nil? || line == 'quit' | |
| Readline::HISTORY.push(line) | |
| puts "echo: #{line}" | |
| 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
| 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 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
| 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 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 '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 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
| #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 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
| #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 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
| mysqldump DBNAME -u USER -p > backup.sql | |
| cat backup.sql | sed s/latin1/utf8/ > converted.sql | |
| mysql -u USER -p --execute="drop database DBNAME;" | |
| mysql -u USER -p --execute="create database DBNAME character set utf8 collate utf8_general_ci;" | |
| mysql DBNAME -u USER -p < converted.sql |
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
| find . -type f -name '*.html' | sed s/html// | xargs -I {} html2haml {}html {}haml |
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/sh | |
| PATH=/opt/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
| NAME=solr | |
| DESC=apache-solr | |
| VERSION=1.4.1 | |
| SOLR_PATH=/opt/solr-$VERSION | |
| COMMAND=/usr/bin/java | |
| OPTIONS="-Dsolr.solr.home=$SOLR_PATH/solr -Djetty.home=$SOLR_PATH -jar $SOLR_PATH/start.jar" | |
| PIDFILE=/var/run/$NAME.pid |
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 'uri' | |
| require 'psych' | |
| require 'net/http' | |
| require 'meme' # Install meme_generator | |
| module Campfire | |
| class API | |
| attr_reader :uri, :token, :pass |