Skip to content

Instantly share code, notes, and snippets.

View trueheart78's full-sized avatar
💖

Josh Mills trueheart78

💖
View GitHub Profile
@zumbojo
zumbojo / bijective.rb
Created July 9, 2011 22:09
Simple bijective function (base(n) encode/decode)
# Simple bijective function
# Basically encodes any integer into a base(n) string,
# where n is ALPHABET.length.
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047
ALPHABET =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//)
# make your own alphabet using:
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join
@ahoward
ahoward / a.rb
Created May 8, 2012 15:39
style is the only thing.
# shitty
attributes[:name] = options[:name] unless options[:name].blank?
attributes[:first_name] = options[:first_name] unless options[:first_name].blank?
attributes[:last_name] = options[:last_name] unless options[:last_name].blank?
attributes[:linkedin_id] = options[:linkedin_id] unless options[:linkedin_id].blank?
attributes[:company] = options[:company] unless options[:company].blank?
attributes[:company_id] = options[:company_id] unless options[:company_id].blank?
attributes[:linkedin_picture_url] = options[:linkedin_picture_url] unless options[:linkedin_picture_url].blank?
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 10, 2024 16:49
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@tedwardd
tedwardd / alias_sync.sh
Created May 6, 2013 20:01
Scripts for using Mutt successfully with Active Directory and Exchange calendars
#!/bin/bash
if [[ -f /tmp/aliases.old ]]; then
rm -f /tmp/aliases.old
fi
if [[ -f /tmp/aliases.txt ]]; then
mv /tmp/aliases.txt /tmp/aliases.old
fi
@noeticpenguin
noeticpenguin / RestClient.java
Created October 21, 2013 13:05
A basic Rest Client for Salesforce's Apex
Public with sharing virtual class RestClient {
Public class RestClientException extends Exception {}
/*
* class variable creation - DO NOT EDIT
*/
Public Map<String,String> headers;
Public String url;
Public String method;
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

#!/usr/bin/env python2.7
"""To use:
First, run `pip install python-twitter`
Then, you'll need to create a twitter application at apps.twitter.com. This
will give you the API key & secret. Set its permissions to be Read & Write.
Then you'll generate an access token on the same page and put all four values
in the appropriate variables below.
Once that's done, just run ./twitter_autoblock_rts.py <some-tweet-id>
@herrphon
herrphon / capture_io_spec.rb
Last active April 20, 2023 04:07
ruby rspec capture I/O stdout/stderr
require 'pp'
module Helper
def capture(&block)
begin
$stdout = StringIO.new
$stderr = StringIO.new
yield
result = {}
result[:stdout] = $stdout.string
#!/bin/bash
for f in `find ~/.ssh -perm 600 -type f`
do
add_key=true
for k in `ssh-add -l`
do
if [[ "$k" = "$f" ]]
then
add_key=false
fi
@ringmaster
ringmaster / tracklist.md
Last active February 11, 2016 19:35
Rap Complaint Track List

"Here Comes the Cat"

"Where My Leftovers At?"

"Your Pull Request is Bad and You Should Feel Bad"

“Bus Nonsense”

“Your Friend Smells Bad”

"You Think You Know Philly Cheesesteaks"

"Making Bread"

"Remote Life"

"Hydroponics"

"So Many Headphones"