Skip to content

Instantly share code, notes, and snippets.

@charles-hollenbeck
charles-hollenbeck / keybase.md
Last active August 29, 2015 14:00
Keybase.io Verification

Keybase proof

I hereby claim:

  • I am charles-hollenbeck on github.
  • I am sh (https://keybase.io/sh) on keybase.
  • I have a public key whose fingerprint is 8762 193C 76E2 F523 51B5 CD7D DB36 7B85 5DB9 4335

To claim this, I am signing this object:

@charles-hollenbeck
charles-hollenbeck / rubybullet.rb
Created February 28, 2014 17:10
Gets a list of packages needed to update and pushes a notification to a pushbullet device.
require 'net/https'
require 'uri'
require 'json'
PUSHBULLET_API_URL = "https://api.pushbullet.com/api/pushes"
PUSHBULLET_API_KEY = ""
PUSHBULLET_DEVICE_ID = ""
# make root only later
# -*- mode: ruby; encoding: utf-8 -*-
require 'albacore'
require 'win32/shortcut'
task :default => :shortcut
BUILD_DIR='viewer-local'
ENV['LANG'] = 'C'
@charles-hollenbeck
charles-hollenbeck / gist:8676586
Created January 28, 2014 21:11
Checks a directory's size and cleans it out if it's too large.
#!/bin/bash
size=$(du /home/charles/screenshots --bytes | grep '[0-9]*' -o)
max=$(expr 1024 \* 1024 \* 1024 \* 2)
if [[ "$size" -gt "$max" ]]; then
rm /home/charles/screenshots/*
fi
@charles-hollenbeck
charles-hollenbeck / rubysetup.sh
Created January 28, 2014 07:08
Setup Ruby via rvm with bundler.
\curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.0.0
rvm use 2.0.0
gem install bundler
@charles-hollenbeck
charles-hollenbeck / cloudflareippoint.rb
Last active August 7, 2016 00:54
Change all of the A records in your cloudflare account to point at a new IP
#!/usr/bin/env ruby
# Change all of the A records in your cloudflare account to point at a new IP
# chmod +x file.rb;./file.rb to run
# Example command: ./file.rb <ip> or let it prompt you
require 'cloudflare' # Laziness at it's best; Source: https://github.com/B4k3r/cloudflare
# Just some coloring crap
class String
def colorize(color_code); "\e[#{color_code}m#{self}\e[0m" end
@charles-hollenbeck
charles-hollenbeck / Pastebin.php
Last active July 17, 2022 02:26
Pastebin API in PHP; $pastebin = new Pastebin("DEVKEY"); $pastebin->login("USER", "PASS"); $pastebin->deletePaste("pasteid");
<?
class Pastebin{
private $token;
private $devkey;
private $loginURL = 'http://www.pastebin.com/api/api_login.php';
private $pasteURL = "http://www.pastebin.com/api/api_post.php";
function __construct($devkey){
$this ->devkey = $devkey;
}
function login($username, $password){
@charles-hollenbeck
charles-hollenbeck / gitpush
Created August 19, 2013 10:05
Simple script to push to muliple git repos at once
#!/bin/bash
#Simple script to push to muliple git repos at once
#Usage: gitpush remote1 remote2 remote3
for var in "$@"
do
git push -u "$var" master
done
@charles-hollenbeck
charles-hollenbeck / Defiance.java
Last active December 18, 2015 16:19
Auto fills in the ark fall keys for defiance.
/*******************************************************
* Plugs in Arkfall Keys into the website for Defiance *
********************************************************/
import java.awt.event.KeyEvent;
import java.awt.AWTException;
import java.awt.Robot;
public class SendKeys {
public static void main(String[] args) throws AWTException, InterruptedException{
@charles-hollenbeck
charles-hollenbeck / rm -rv * [Excluded]
Created June 18, 2013 23:32
Same as rm -rv * but allows you to exclude files
#!/bin/sh
#A simple script to clean out a directory except for the files you wish to save
for file in "$@"
do
mv -v $file ..
done
rm -rv *
for file in "$@"
do