Skip to content

Instantly share code, notes, and snippets.

View andrew-carroll's full-sized avatar

Andrew Carroll andrew-carroll

View GitHub Profile
@andrew-carroll
andrew-carroll / backlight.sh
Last active January 13, 2018 02:19
Displays and sets backlight level for intel laptops. Tested with xubuntu 16.04.
#!/usr/bin/env sh
if [ -n "$1" ]; then
sudo su -c "echo $1 >/sys/class/backlight/intel_backlight/brightness"
else
cat /sys/class/backlight/intel_backlight/brightness
fi
stdbuf -oL alsactl monitor | \
while read; do
amixer -D pulse sset Capture 32767,0
done
#!/usr/bin/env ruby
require 'headless'
require 'watir-webdriver'
require 'highline/import'
module BankAccounts
module TDBank
class Balance
LOGIN_URL = 'onlinebanking.tdbank.com'
def initialize
#!/usr/bin/env ruby
require 'webrick/httpproxy'
port = ARGV[0] or 8000
server = WEBrick::HTTPProxyServer.new(Port: port)
server.mount_proc('/'){|req,res|}
server.start
require 'music_player'
require 'timer'
class AlarmClock
def initialize(music_player, timer)
@music_player = music_player
@timer = timer
end
def start
@timer.start { @music_player.start }
#!/usr/bin/env ruby
pwd = `pwd`.strip
targets = if ARGV.empty?
Dir["#{pwd}/*"]
else
ARGV.map do |arg|
Dir["#{arg.strip.gsub(/\/*$/,'')}/*"]
end.flatten.uniq
end
class CreateFriendships < ActiveRecord::Migration
def change
create_table :friendships do |t|
t.belongs_to :person, index: true, null: false, foreign_key: true
t.belongs_to :friend, index: true, null: false, foreign_key: true
t.timestamps null: false
end
end
end
@andrew-carroll
andrew-carroll / encfs.sh
Created August 4, 2015 05:53
Wrapper for encfs that allows relative paths.
#!/usr/bin/env bash
if [[ $# -ne 2 ]]; then
echo "Usage: $0 ./encrypted/dir ./visible/dir"
fi
/usr/bin/encfs $(readlink -f $1) $(readlink -f $2)
// Place all the styles related to the pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
.splash {
@extend .col-xs-12;
background: linear-gradient(to bottom, rgba(20, 20, 80, 0.5) 0%, rgba(20, 20, 80, 0.5) 100%), url(hero2.jpg);
background-size: cover;
min-height: 85vh;
color: #DED;
#!/usr/bin/env ruby
require 'watir-webdriver'
require 'webrick/httpproxy'
# USAGE: ./proxied_browser.rb server (port) [json]
# ./proxied_browser.rb browser (port)
class ProxiedBrowser < Watir::Browser
def initialize(port)
proxy = ['localhost',port].join(?:)