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 | |
import time | |
from datetime import datetime, timedelta | |
from dotenv import load_dotenv, find_dotenv | |
from urllib.request import urlopen | |
from concurrent.futures import ThreadPoolExecutor, wait | |
def main(): | |
print("running!") | |
load_dotenv(find_dotenv()) |
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
echo "commit,reverted" && git log -600 | grep -B 8 'This reverts commit' | awk '/commit/ {if($1 == "This") { printf "%s %s\n", substr($4, 0, length($4) - 1), nextline } else { printf "%s, ", $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
# import the library that allows us to logically access the GPIO pins | |
# refer to the library as GPIO, it is like an alias | |
import RPi.GPIO as GPIO | |
import time | |
# use the BCIM numbering scheme | |
GPIO.setmode(GPIO.BCM) | |
# set pin 18 to be in output mode | |
GPIO.setup(18, GPIO.OUT) |
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
# per sean cribb's suggestion some time ago | |
User.new.becomes(Super::User) # thanks Rails :) | |
# below not needed, for reference | |
User = Class.new(ActiveRecord::Base) | |
class Super::User < ::User | |
def self.wrap(user) |
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
# after pasting the class in speaker.rb into irb, run the following, | |
# edit to your liking... | |
@speaker = Speaker.new | |
# other voices can be found at | |
# http://www.gabrielserafini.com/blog/2008/08/19/mac-os-x-voices-for-using-with-the-say-command/ | |
@speaker.voice = 'Kathy' | |
@speaker.what = %[what should i say here?] |
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
# Set Apple Terminal.app resume directory (OS X Lion feature) | |
if [[ $TERM_PROGRAM == "Apple_Terminal" ]] && [[ -z "$INSIDE_EMACS" ]] { | |
# function must be named chpwd so when new tab is opened it will go to the | |
# current working directory | |
function chpwd { | |
local SEARCH=' ' | |
local REPLACE='%20' | |
local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}" | |
printf '\e]7;%s\a' "$PWD_URL" | |
} |
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
# spec/dummy/config/application.rb | |
ENV['BUNDLE_GEMFILE'] = File.expand_path('../../../../Gemfile', __FILE__) | |
require 'rubygems' | |
require 'bundler' | |
Bundler.setup | |
$:.unshift File.expand_path('../../../../lib', __FILE__) |
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 'mkmf' | |
have_header('ruby.h') or missing('ruby.h') | |
dir_config("ivar") | |
create_makefile("ivar") |
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
it "returns the list of possible industries for this account" do | |
fake_industries = ['Deforester', 'Sludge Distillery'] # Captain Planet hates these | |
@cavs_api.stub(:industries).and_return(fake_industries) | |
estimator.industries.should eq(fake_industries) | |
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 'riak' | |
class RiakCache | |
def initialize | |
@client = Riak::Client.new(:pb_port => 8081, :protocol => :pbc) | |
@bucket = @client.bucket("riakcache") | |
end | |
def read(key) |
NewerOlder