Skip to content

Instantly share code, notes, and snippets.

@IsraelBuitronD
IsraelBuitronD / backup-gpg-key.sh
Last active October 27, 2015 06:23
Backup, archive and encrypt gpg key-pair
#!/bin/bash
if [ $# -ne 1 ] ; then
echo "USAGE: $0 <gpg-key-id>"
exit 1;
fi
KEY_ID=$1
@IsraelBuitronD
IsraelBuitronD / gist:af2b814dd885c47cd32a
Created May 16, 2015 05:50
Import GPG public-key from a keyserver
gpg --keyserver pool.sks-keyservers.net --recv-key 0x37F0407D
gpg: requesting key 37F0407D from hkp server pool.sks-keyservers.net
gpg: key 37F0407D: "Israel Buitron <[email protected]>" not changed
gpg: Total number processed: 1
@IsraelBuitronD
IsraelBuitronD / gist:7516cf30220fa6c79aac
Created May 16, 2015 05:19
Export GPG public-key to keyserver
➜ ~ gpg --list-key
/Users/israel/.gnupg/pubring.gpg
--------------------------------
pub 4096R/37F0407D 2013-01-01
uid Israel Buitron <[email protected]>
gpg: conversion from 'utf-8' to 'US-ASCII' failed: Illegal byte sequence
uid Israel Buitron (Correo electrónico en el IPN) <[email protected]>
uid Israel Buitron <[email protected]>
sub 4096R/0D6D8EA7 2013-01-01 [expires: 2016-01-01]
@IsraelBuitronD
IsraelBuitronD / gist:cf81474ecde98858261f
Last active January 7, 2016 19:34
GPG generation key
gpg --gen-key
gpg (GnuPG/MacGPG2) 2.0.22; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
@IsraelBuitronD
IsraelBuitronD / gist:fd4c97cc891c7cdf6ab8
Created March 8, 2015 10:05
Split comma-separated string in C
#include <string.h>
#include <stdio.h>
char str[] = "1,2,3,4,5";
char *tmp = NULL;
for(int i=0; (tmp = strsep(&str, ",")) != NULL; ++i) {
printf("%s\n", tmp);
}
@IsraelBuitronD
IsraelBuitronD / gist:3e30478f7c8b66278556
Created December 25, 2014 02:30
Check if integer is odd or even
if((x&1) == 0) {
// x is even
} else {
// x is odd
}
@IsraelBuitronD
IsraelBuitronD / ffs_clz_ctz.c
Created December 3, 2014 23:31
Find first set (ffs), count leading zeros (clz) and count trailing zeros (ctz) built-in C functions
#include <stdlib.h>
#include <stdio.h>
// Compilation command:
// gcc -std=c11 lab.c
//
// References:
// - http://en.wikipedia.org/wiki/Find_first_set
int main(int argc, char const *argv[]) {
@IsraelBuitronD
IsraelBuitronD / function.tex
Last active August 29, 2015 14:01
Function definition with domain
\begin{equation}
\begin{split}
f :
\mathbb{R} & \to \mathbb{R}\\
x & \mapsto \frac{\sin x}{x}
\end{split}
\end{equation}
@IsraelBuitronD
IsraelBuitronD / gist:4184441
Created December 1, 2012 19:40
Android debug MD5 fingerprint
keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android