Skip to content

Instantly share code, notes, and snippets.

View Spone's full-sized avatar
🚴

Hans Lemuet Spone

🚴
View GitHub Profile
@Spone
Spone / Favicon
Last active December 25, 2015 01:59
Favicon code
4 files are needed:
/favicon.ico is a 16x16 ico file
/favicon.png is a 96x96 png file
/tileicon.png is a 144x144 png file
/touchicon.png is a 152x152 png file
source: http://www.jonathantneal.com/blog/understand-the-favicon/
@Spone
Spone / .install go and hk.sh
Last active December 26, 2015 14:39
How to install hk on Ubuntu Precise 32bit https://github.com/heroku/hk
cd /tmp
wget https://godeb.s3.amazonaws.com/godeb-386.tar.gz
tar -zxvf godeb-386.tar.gz
./godeb install
go get github.com/heroku/hk
nano $HOME/.netrc
@Spone
Spone / seats.rb
Last active January 2, 2016 11:09
How to generate plane seats numbers (01A to 50J) using a FactoryGirl sequence
FactoryGirl.define do
factory :seat do
sequence(:number, 0) { |n|
"%02d%s" % [
n % 50 + 1, # the row number (01 to 50)
('A'..'J').to_a[n / 50 % 10] # the column letter (A to J)
]
}
end
end
@Spone
Spone / gist:fd33f04cf8b8857e5549
Last active August 29, 2015 14:12 — forked from tistaharahap/gist:1202974
HMAC-SHA1 Utility for Android
public static String sha1(String s, String keyString) throws
UnsupportedEncodingException, NoSuchAlgorithmException,
InvalidKeyException {
SecretKeySpec key = new SecretKeySpec((keyString).getBytes("UTF-8"), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(key);
byte[] bytes = mac.doFinal(s.getBytes("UTF-8"));
@Spone
Spone / gist:55972369fa5b6ed2ba51
Created January 2, 2015 22:37 — forked from mingcheng/gist:5472680
Android/Java equivalent of MD5 function in PHP
public static String md5(String string) {
byte[] hash;
try {
hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Huh, MD5 should be supported?", e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Huh, UTF-8 should be supported?", e);
}
@Spone
Spone / simple-git-branching-model.md
Created November 27, 2015 14:58 — forked from jbenet/simple-git-branching-model.md
a simple git branching model

a simple git branching model

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

==> default: Unpacking python-pip-whl (1.5.4-1ubuntu4) ...
==> default: Selecting previously unselected package python-setuptools.
==> default: Preparing to unpack .../python-setuptools_3.3-1ubuntu2_all.deb ...
==> default: Unpacking python-setuptools (3.3-1ubuntu2) ...
==> default: Selecting previously unselected package python-pip.
==> default: Preparing to unpack .../python-pip_1.5.4-1ubuntu4_all.deb ...
==> default: Unpacking python-pip (1.5.4-1ubuntu4) ...
==> default: Selecting previously unselected package python-wheel.
==> default: Preparing to unpack .../python-wheel_0.24.0-1~ubuntu1_all.deb ...
==> default: Unpacking python-wheel (0.24.0-1~ubuntu1) ...
@Spone
Spone / keybase.md
Created June 4, 2017 00:47
Keybase

Keybase proof

I hereby claim:

  • I am spone on github.
  • I am hanslemuet (https://keybase.io/hanslemuet) on keybase.
  • I have a public key ASB_afv8TUK0dZ6LWEiuk0UCSJ6MgFXcOSP3FQy5M7knAQo

To claim this, I am signing this object:

require 'json'
require 'open-uri'
puts "Hello. What username do you want to check?"
print "> "
username = gets.chomp
url = "https://api.github.com/users/#{username}"
user_serialized = open(url).read
# Chrismas List in pseudo-code
# 1. Welcome
puts "Welcome to the Chrismas list!"
# items = [
# 'puppy',
# 'bag',
# 'video game'