Skip to content

Instantly share code, notes, and snippets.

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active Apr 30, 2022
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!
View whiteboardCleaner.md

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

@drtoast
drtoast / gist:7159912
Created Oct 25, 2013
Jailbreaking a Google Search Appliance
View gist:7159912
These are my notes from my abandoned project to wipe and reuse a Google Search Appliance:
Dell PowerEdge 2950 (model EMS01)
http://support.dell.com/support/edocs/systems/pe2950/en/hom/html/index.htm
Disable BIOS Password
http://support.dell.com/support/edocs/systems/pe2950/en/hom/html/jumpers.htm#wp1054535
@zadr
zadr / pre-push
Last active Dec 19, 2015
Prevent pushes that break the build.
View pre-push
# Requires git 1.8.2 or above. This excludes `git` from Xcode 4.6, but should include `git` from Xcode 5 and homebrew.
# Not perfect. If you've done anything since your last commit that breaks the build, this will incorrectly fail. Maybe do something like https://twitter.com/drance/status/354365644147392513 + https://twitter.com/cbarrett/status/354372047062835201)?
# Install by adding this file into .git/hooks, naming it `pre-push`
#!/bin/sh
# go into the dir that contains the xcodeproj
cd Foo
# build the xcodeproj for your scheme (and/or configuration)
View oauth-v2-rfc6749.markdown

The OAuth 2.0 Authorization Framework

This document is intended to be a simplified version of the OAuth 2.0 specification. In particular it has been written with implementors in mind, and as such attempts to trim the spec down to just what you need to implement an OAuth provider or client. It is necessarily not complete, but attempts to introduce spec requirements in the same order in which the protocol proceeds in practise, with everything you need to know about each protocol endpoint brought together in one place rather than scattered across a large document.

@fnichol
fnichol / README.md
Created Feb 26, 2012
A Common .ruby-version File For Ruby Projects
View README.md

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@bunnymatic
bunnymatic / gist:1648765
Last active Feb 22, 2020
compute histogram in ruby
View gist:1648765
def tally inp; hash = Hash.new(0); inp.each {|k,v| hash[k] +=v}; hash; end
def histogram inp; hash = Hash.new(0); inp.each {|v| hash[v]+=1}; hash; end
def histogram2 inp; Hash[*inp.group_by{ |v| v }.flat_map{ |k, v| [k, v.size] }] end
def test_tally
tally([['a',1],['b',1],['a',1],['c',1],['a',3], ['c',1]]) == {'a'=>5, 'b'=>1, 'c'=>2}
end
def test_histogram
histogram(['a','b','a','c','a', 'c']) == {'a'=>3, 'b'=>1, 'c'=>2}
@rudyjahchan
rudyjahchan / Rakefile
Created Jun 9, 2011
Building and Deploying iOS Projects through Rake
View Rakefile
require 'yaml'
require 'uri'
require 'tempfile'
require 'tmpdir'
SDK_DIR = "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk"
TESTFLIGHT_URL = 'http://testflightapp.com/api/builds.json'
PROJECT_DIR = File.dirname __FILE__
RUBIOS_DIR = File.join(PROJECT_DIR, 'rubios')
View quickerclip.rb
module Paperclip
class Geometry
def self.from_file file
parse("100x100")
end
end
class Thumbnail
def make
src = Test::FileHelper.fixture_file('white_pixel.jpg')
dst = Tempfile.new([@basename, @format].compact.join("."))