Skip to content

Instantly share code, notes, and snippets.

@cota
cota / gpg.sh
Created December 1, 2019 23:10
export/import a GPG key
# Export a specific `foo@bar.com` key in an encrypted (i.e. password-protected) file `mykey.sec.asc`
gpg --armor --export-secret-keys foo@bar.com | gpg --armor --symmetric --output mykey.sec.asc
# Import the key in `mykey.sec.asc`. `gpg` will ask for the password used when exporting.
gpg --no-use-agent --output - mykey.sec.asc | gpg --import
@cota
cota / get_maintainer-to-git-send-email.sh
Created June 15, 2017 23:06
qemu's get_maintainer to git-send-email
scripts/get_maintainer.pl *.patch | cut -f1 -d'(' | sed 's/ $//' | sed 's/\(.*\)/--cc=\\"\1\\"/' | xargs
sudo apt-get install libmoose-perl libtemplate-perl libmoosex-types-path-class-perl libdatetime-perl libdatetime-format-w3cdtf-perl libtemplate-plugin-html-strip-perl libdata-guid-perl
@cota
cota / git-from-source
Created August 16, 2013 15:39
Install git from source. Fixes the "fatal: Unable to find remote helper for 'https'" issue when cloning via https on some installations.
#!/bin/bash
set -e
PREFIX=$HOME
CURL_=curl-7.32.0
CURL=${CURL_}.tar.bz2
if [[ ! -d $CURL_ ]]; then
wget http://curl.haxx.se/download/$CURL
chiliproject@cay2:~$ RAILS_ENV=production rake db:migrate_plugins --trace
** Invoke db:migrate_plugins (first_time)
** Invoke db:migrate:plugins (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
no such file to load -- lockfile
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/var/www/chiliproject/vendor/plugins/redmine-gitolite/lib/gitolite-redmine.rb:1
root@cay2:/var/www/chiliproject# RAILS_ENV=production rake db:migrate:plugins --trace
** Invoke db:migrate:plugins (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
no such file to load -- lockfile
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
/var/www/chiliproject/vendor/plugins/redmine-gitolite/lib/gitolite-redmine.rb:1
/usr/local/rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:184:in `require'
@cota
cota / bitslice.c
Created September 7, 2011 05:36
simple macros to extract u{8,16,32}'s from variables.
/*
* bitslice.c
* build with gcc -Wall.
*
* simple macros to extract u{8,16,32}'s from variables.
*/
#include <stdint.h>
#include <stdio.h>
#define __shift(n, log) ((n) << (log))