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
class PluginBase | |
def self.inherited child | |
# Register 'child' in PluginList | |
puts "ooh sweet #{child} o' mine" | |
end | |
end | |
class X < PluginBase | |
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
import cloudmanager | |
import metachains_dtc | |
import settings | |
coin = metachains_dtc.Datacoin( | |
settings.DATACOIN_URL, | |
settings.DATACOIN_USERNAME, | |
settings.DATACOIN_PASSWORD) |
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
#!/bin/bash | |
btce_price() { | |
python -c 'import json; import sys; print json.load(sys.stdin)["markets"]["btce"]["price"]' | |
} | |
AMOUNT=${1:-1.0} | |
USD=$(curl -sf http://preev.com/pulse/source:btce/unit:btc,usd | btce_price) | |
EUR=$(curl -sf http://preev.com/pulse/source:btce/unit:btc,eur | btce_price) |
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
import os | |
# usage: | |
# with Pid("/var/run/potato.pid"): | |
# do_stuff() | |
def is_running(pid): | |
try: | |
os.kill(pid, 0) | |
except OSError: |
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
def read_yaml_configuration_directory(directory): | |
config = {} | |
for root, _, filenames in os.walk(directory): | |
for fname in filenames: | |
if fname.endswith(".conf"): | |
with open(root + "/" + fname) as f: | |
config.update(yaml.safe_load(f)) | |
return config |
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
#!/usr/bin/env ruby | |
n = ARGV.shift.to_i | |
puts((n.times.map do |i| | |
" "*(n-1-i) + "*"*(1+2*i) | |
end + (n/2).times.map do | |
" "*(n/2) + "#"*(n-1+(n%2)) | |
end).join("\n")) |
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 <stdio.h> | |
#include <dirent.h> | |
int main(int argc, char* argv[]) { | |
int file_count = 0; | |
DIR * dirp; | |
struct dirent * entry; | |
dirp = opendir(argc == 2 ? argv[1] : "."); /* There should be error handling after this */ | |
if (dirp == NULL) { |
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
# daemon-name - registration service | |
# | |
description "registration service" | |
start on (local-filesystems and runlevel [2345]) | |
stop on runlevel [06] | |
setuid v11registration-runner | |
setgid v11registration-runner |
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 <stdio.h> | |
struct fish_key_store { | |
void* data; | |
int (*getter) (void*, const char*, char*, size_t); | |
int (*setter) (void*, const char*, const char*); | |
}; | |
struct fish_key_store fish_key_store_make (void* data, void* getter, void* setter) { | |
return (struct fish_key_store){ |
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
#!/bin/bash | |
curl --silent http://www.debian.org/international/l10n/po-debconf/pt | | |
grep 'href="http://i18n.debian.org/material/po/.*.po.gz">pt.po</a>' | | |
sed -e 's/.*name="\([^"]*\)".*href="\([^"]*\)".*/\1 \2/' | | |
while read line | |
do | |
a=( $line ) | |
name="${a[0]}" | |
url="${a[1]}" |
OlderNewer