Skip to content

Instantly share code, notes, and snippets.

View rohitarondekar's full-sized avatar

Rohit Arondekar rohitarondekar

View GitHub Profile
@rohitarondekar
rohitarondekar / gpg-import-and-export-instructions.md
Created September 4, 2016 03:03 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
(setq x 10)
(defun f (y)
(+ x y))
(defun g ()
(let ((x 100))
(f 1)))
(f 2) ; Evaluates to 12
- val x = ref 2;
val x = ref 2 : int ref
- fun f y = !x + 10;
val f = fn : 'a -> int
- f 10;
val it = 12 : int
- x := 10;
>>> x = 2
>>> def f (y): return x + y
...
>>> f(10)
12
>>> def g ():
... x = 10
... return f(10)
...
>>> g()
- Int.toString;
[autoloading]
unexpected exception (bug?) in SML/NJ: Io [Io: openIn failed on "/home/rohit/sml.boot.x86-unix/smlnj/basis/.cm/x86-unix/basis.cm", No such file or directory]
raised at: Basis/Implementation/IO/bin-io-fn.sml:617.25-617.71
../cm/util/safeio.sml:30.11
../compiler/TopLevel/interact/evalloop.sml:44.55
## Current
```
९ bundle help gem
Usage:
bundle gem GEM
Options:
-b, [--bin=Generate a binary for your library.]
[--no-color=Disable colorization in output]
@rohitarondekar
rohitarondekar / gist:4045084
Created November 9, 2012 10:39
hashing of date obj vs converting to string first before hashing
1.9.3p194 :016 > puts Benchmark.measure { time = Time.now; 10000000.times { time.hash } }
1.270000 0.000000 1.270000 ( 1.278316)
=> nil
1.9.3p194 :017 > puts Benchmark.measure { time = Time.now; 10000000.times { time.to_s.hash } }
23.770000 0.000000 23.770000 ( 23.798103)
##
1.9.3p194 :028 > puts Benchmark.measure { str = "foo"; 10000000.times { str.hash } }
@rohitarondekar
rohitarondekar / gist:4022788
Created November 6, 2012 05:32
Why ruby allows redefining of Module.prepend_features(mod)?
module Foobar
def hello
puts 2
super
end
# Why is Ruby allowing me to redefine this method? If you remove
# call to super then it doesn't actually prepend self to mod.
# Any use case for doing something different like overriding/prepending
# only certain methods (ex: methods starting with foo_) or something else?