Skip to content

Instantly share code, notes, and snippets.

View artefactop's full-sized avatar

Pepe Navarro artefactop

View GitHub Profile
@jespada
jespada / git-log
Created June 19, 2012 12:29
nice git log
#See a nice git log:
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
#configure that git log by default
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
#next time just
git lg
@renatoalbano
renatoalbano / encode_uri_rfc3986.erl
Created September 27, 2012 21:06
erlang percent encoding that works with utf-8
-module(encode_uri_rfc3986).
-author('Renato Albano <[email protected]>').
-export([encode/1]).
%% Taken from <http://erlangexamples.com/>,
%% from <http://github.com/CapnKernul/httparadise>
%% and <http://www.erlang.org/doc/man/edoc_lib.html>
encode([C | Cs]) when C >= $a, C =< $z ->
@artefactop
artefactop / calendar_iso8601.erl
Created May 21, 2013 18:04
erlang dates to integer iso8601
date_to_integer_iso8601({date,{Y,M,D}}) ->
datetime_to_integer_iso8601({datetime,{{Y,M,D},{0,0,0}}}).
datetime_to_integer_iso8601({datetime,{{Y,M,D},{H,Min,S}}}) ->
Y * 10000000000 + M * 100000000 + D * 1000000 + H * 10000 + Min * 100 + S.
@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 12, 2025 01:59
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@pnc
pnc / observer.md
Last active April 1, 2025 21:38
Using Erlang observer/appmon remotely

Using OTP's observer (appmon replacement) remotely

$ ssh remote-host "epmd -names"
epmd: up and running on port 4369 with data:
name some_node at port 58769

Note the running on port for epmd itself and the port of the node you're interested in debugging. Reconnect to the remote host with these ports forwarded:

$ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 remote-host
@syedrakib
syedrakib / RSA_example.py
Last active June 21, 2024 19:48
An example of asymmetric encryption in python using a public/private keypair - utilizes RSA from PyCrypto library
# Inspired from http://coding4streetcred.com/blog/post/Asymmetric-Encryption-Revisited-(in-PyCrypto)
# PyCrypto docs available at https://www.dlitz.net/software/pycrypto/api/2.6/
from Crypto import Random
from Crypto.PublicKey import RSA
import base64
def generate_keys():
# RSA modulus length must be a multiple of 256 and >= 1024
modulus_length = 256*4 # use larger value in production
@p3t3r67x0
p3t3r67x0 / openssl_commands.md
Last active May 15, 2025 17:31
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@jeffarese
jeffarese / qhdpullrequest.js
Last active August 24, 2016 14:49
FHD & QHD width on Github pull requests
javascript:(function(){ var style = document.createElement(%27style%27), styleContent = document.createTextNode(%27.container { width: 1600px !important; } .timeline-comment-wrapper { width: 1380px !important; } .comment-holder{ max-width: none !important;} .discussion-item { width: 1300px !important; }%27); style.appendChild(styleContent ); var caput = document.getElementsByTagName(%27head%27); caput[0].appendChild(style); })();