Skip to content

Instantly share code, notes, and snippets.

View whitehat101's full-sized avatar

Jeremy whitehat101

View GitHub Profile
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active October 23, 2024 21:10
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@brendonrapp
brendonrapp / colors
Created January 11, 2012 19:22
LegionSB's git prompt
##################
# ~/.bash/colors #
##################
#!/bin/bash
# vim:set syntax=bash
## Colors
# Normal
BLACK='\033[0;30m'
@emanuelez
emanuelez / git_speed.md
Last active September 25, 2024 11:24
Git Speed

How Fast is Git?

The web is full of benchmarks showing the supernatural speed of Git even with very big repositories, but unfortunately they use the wrong variable. Size is not important, but the number of files in the repository really is!

Why is that? Well, that's because Git works in a very different way compared to Synergy. You don't have to checkout a file in order to edit it; Git will do that for you automatically. But at what price?

The price is that for every Git operation that requires to know which files changed (git status, git commmit, etc etc) an lstat() call will be executed for every single file

Wow! So how does that perform on a fairly large repository? Let's find out! For this example I will use an example project, which has 19384 files in 1326 folders.

@mitfik
mitfik / ruby_csr_example.rb
Created February 27, 2012 10:13
Ruby example of CSR with openssl
require 'openssl'
def gen_key(name)
key = OpenSSL::PKey::RSA.new 1048
file = File.new(name, "w")
file.write(key)
file.close
end
def get_key(name)
@mybuddymichael
mybuddymichael / .gitignore
Created March 10, 2012 23:11
Starter Stasis project
/.sass-cache
/public
@paulnicholson
paulnicholson / powssl
Last active June 6, 2025 19:19
ssl with pow using stud

Instructions

  • Install stud $ brew install https://raw.github.com/paulnicholson/homebrew/master/Library/Formula/stud.rb
  • Download and install the powssl script $ curl https://gist.githubusercontent.com/paulnicholson/2050941/raw/7e4d2178e3733bed18fdfe737277c3cb72241d39/powssl > ~/bin/powssl $ chmod +x ~/bin/powssl
  • Run powssl to create development certificate and configure stud.
  • $ powssl
@pmarreck
pmarreck / rubyhashflip.rb
Created April 3, 2012 18:31
How to get hash format flipping between Ruby 1.8-style and Ruby 1.9-style in Sublime Text 2
# First, install the Sublime package SublimeExternalCommand with the Package Control sublime package.
# Then add the following file in your ~/bin (or somewhere in your PATH, note that you may have to change some paths later here) and call it "rubyhashflip" and chmod +x it:
#!/usr/bin/env ruby
begin
require 'hash_syntax'
rescue LoadError
puts `gem install hash_syntax 2>&1`
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@EmmanuelOga
EmmanuelOga / autocrop.rb
Created April 24, 2012 03:26
RMagick autocropper
require 'RMagick'
# Auto crop an image by detecting solid edges around them.
class AutoCropper
# How small we accept a cropped picture to be. E.G. if it was 100x100 and
# ratio 0.1, min output should be 10x10
MIN_CROP_RATIO = 0.1
attr_reader :img, :x0, :y0, :x1, :y1, :min_width, :min_height, :rows, :columns, :is_border
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",