Skip to content

Instantly share code, notes, and snippets.

View icoloma's full-sized avatar

Nacho Coloma icoloma

View GitHub Profile
@icoloma
icoloma / Check out branch directly
Last active March 13, 2017 19:41
Create a github-pages branch from scratch on an existing repo
git clone -b gh-pages <remote_repo> <folder-name>
@icoloma
icoloma / from-agenda-get-authors
Last active September 16, 2018 08:29
Snippets around the agenda for Commit Conf
// extract all author names
const authorNames = new Set();
agenda.days.forEach(
d => d.tracks.forEach(
t => t.slots.forEach(
s => {
if (s.contents && s.contents.authors) {
s.contents.authors.forEach(({name}) => authorNames.add(name))
}
}
@icoloma
icoloma / BigQuery.sh
Last active November 18, 2019 10:53
Google Cloud Recipe Book
# Get the list of jobs launched for a given project (the project ID is optional)
bq ls -j -n 10000 -a project_id > jobs.txt
bq ls -j -n 10000 -a marine-tractor-567789 > jobs.txt
# Get the details for a given job (the project ID is optional)
bq show --format=prettyjson -j project_id:job_id
bq show --format=prettyjson -j marine-tractor-567789:job_ftnDrpo8JqiJtajBH2AEZxJCLpw
More details: http://stackoverflow.com/questions/31150542/logging-all-bigquery-queries
@icoloma
icoloma / backup
Last active March 2, 2018 04:45
Backup a Github repository into a local file. Useful when retiring a Github repository, but keeping a backup copy for a rainy day in Dropbox / Drive / Box.
#!/bin/bash
# Backup the repositories indicated in the command line
# Example:
# bin/backup user1/repo1 user1/repo2
set -e
for i in $@; do
FILENAME=$(echo $i | sed 's/\//-/g')
echo "== Backing up $i to $FILENAME.bak"
git clone git@github.com:$i $FILENAME.git --mirror
cd "$FILENAME.git"
@icoloma
icoloma / keybase.md
Created March 28, 2014 07:14
keybase.md

Keybase proof

I hereby claim:

  • I am icoloma on github.
  • I am icoloma (https://keybase.io/icoloma) on keybase.
  • I have a public key whose fingerprint is 1273 BC17 C42F 96B1 616D A4E8 5164 B8EC 99C7 D0E7

To claim this, I am signing this object:

@icoloma
icoloma / maps-csp-test.js
Last active December 31, 2015 04:29
Test for using Google Maps with Content-Security-Policy
var http = require('http')
// To use: execute "node maps-csp-test.js" and open a browser at localhost:8000
// remember to restart the server after making any changes
var server = http.createServer( function(request, response) {
response.writeHead(200, {
'Content-Type': 'text/html; charset=UTF-8'
// This makes Google Maps work
@icoloma
icoloma / gist:7315985
Created November 5, 2013 09:06
Proxy in China
ssh somehost -D 6070
# then point your browser to use socks5://locahost:6070 as a proxy
@icoloma
icoloma / .zshrc
Last active December 25, 2015 13:18 — forked from SlexAxton/.zshrc
Create screencasts
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@icoloma
icoloma / gist:6751262
Created September 29, 2013 10:27
Git shortcuts
# Create a serverfix branch synchronized with origin
git checkout --track origin/serverfix
@icoloma
icoloma / gist:6316635
Created August 23, 2013 07:53
Concatenate PDFs
gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf