Skip to content

Instantly share code, notes, and snippets.

View eduardo's full-sized avatar

Edu Fernández eduardo

View GitHub Profile
@Sjors
Sjors / bitcoin-pay.rb
Last active April 9, 2024 16:50
This script demonstrates how a bitcoin transaction is created and signed. Just pass in your own address and private key and it will prepare a transaction for you. You can then copy & paste that transaction into a webservice like Blockchain to send it. I wrote this mostly to understand better how it works. I sometimes had to "cheat" and look at t…
#!/usr/bin/env ruby
require 'open-uri'
require 'JSON'
require 'digest/sha2'
require 'pry'
require 'bigdecimal'
require 'bitcoin' # Because I need to cheat every now and then
# Usage:
# gem install pry json ffi ruby-bitcoin
@narze
narze / .slate
Created May 9, 2013 11:06
@narze's slate.app config
This is the default .slate file.
# If no ~/.slate file exists this is the file that will be used.
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# General aliases
alias sox screenOriginX
alias soy screenOriginY
@fxn
fxn / gist:5404357
Created April 17, 2013 13:37
Custom Keymap for RubyMine (by fxn)
# Custom Keymap for RubyMine (by fxn)
The keymap I work with, inspired by my past Emacs years, these are configurable
in Preferences -> Keymap.
Most of these have no conflict with the existing shortcuts, I use the default
keymap for Mac OS X and add these ones (an action can have several shortcuts).
To configure two strokes enter the first one in the main textfield (eg, C-g),
check "Second Stroke" and the second one there (eg, c).
@samstokes
samstokes / todo
Last active January 3, 2025 01:29
A todo management system in a gist
#!/usr/bin/env bash
set -e
if [[ $# > 0 ]]; then
case "$1" in
-h | -\? | --help )
{
echo "Add a todo:"
echo " todo Reformulate the widget plans."
@pmarreck
pmarreck / encrypt_decrypt.sh
Last active September 23, 2021 20:18
Some easy bash scripts to encrypt/decrypt data, for anyone who wants to go all cloak&dagger. (bitcoin private keys, etc.)
# Encryption functions. Requires the GNUpg "gpg" commandline tool. On OS X, "brew install gnupg"
# Explanation of options here:
# --symmetric - Don't public-key encrypt, just symmetrically encrypt in-place with a passphrase.
# -z 9 - Compression level
# --require-secmem - Require use of secured memory for operations. Bails otherwise.
# cipher-algo, s2k-cipher-algo - The algorithm used for the secret key
# digest-algo - The algorithm used to mangle the secret key
# s2k-mode 3 - Enables multiple rounds of mangling to thwart brute-force attacks
# s2k-count 65000000 - Mangles the passphrase this number of times. Takes over a second on modern hardware.
# compress-algo BZIP2- Uses a high quality compression algorithm before encryption. BZIP2 is good but not compatible with PGP proper, FYI.
@unhammer
unhammer / window-left.sh
Created April 8, 2013 13:41
window-left/right
#!/bin/sh
WIDTH=`xdpyinfo | grep 'dimensions:' | cut -f 2 -d ':' | cut -f 1 -d 'x' `&&
HALF=$(($WIDTH/2)) &&
wmctrl -r :ACTIVE: -b remove,maximized_horz &&
wmctrl -r :ACTIVE: -b add,maximized_vert &&
wmctrl -r :ACTIVE: -e 0,0,0,$HALF,-1
@veered
veered / gist:4759121
Created February 12, 2013 01:01
This is the working config file
config defaultToCurrentScreen true
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
config windowHintsSpreadPadding 40
config windowHintsSpreadSearchWidth 80
config windowHintsSpreadSearchHeight 80
config switchIconPadding 2
config switchBackgroundColor 50;53;58;0.7
config switchSelectedPadding 4
@nelhage
nelhage / make_yaml_safe.rb
Last active December 10, 2015 23:08
Neuter YAML to help mitigate CVE-2013-0156-style attacks.
# The fact that YAML.load will instantiate arbitrary ruby objects
# means that calling `YAML.load` on untrusted data is virtually always
# equivalent to executing arbitrary code in a complex app.
# This code fragment globally neuters YAML to disable this behavior,
# which should (hopefully) cut off all such attacks from the start.
# I don't promise this closes all possible attacks, but this closes
# off the trivial case. You should audit and upgrade all your
# dependencies, as well.
@gorkunov
gorkunov / gist:4225560
Created December 6, 2012 15:57
Smart Selection for VIM
" About:
"
" How often do you forget which keys you should use to select/modify strings
" in the ' or " or in other pairs? I often use viw/ciw instead of vi'/vi" for
" the first time because it easier for my fingers (but after that I remember
" about vi'). This script allows you always use the same shortcut for all
" cases. When you want to select string in the ' use viv. Do you want to
" select all in the '()'? Use viv. All in the '[]'? Use viv.
"
" How it works:
@sachinr
sachinr / siyelo_reading_list.md
Created November 8, 2012 14:26
Siyelo's reading list

Personal Development

The Passionate Programmer

Ruby

The Ruby Programming Language - David Flanagan, Yukihiro Matsumoto

Programming Ruby 1.9 - Dave Thomas, Chad Fowler, Andy Hunt