Skip to content

Instantly share code, notes, and snippets.

import httplib, json
import getopt, sys, os
import subprocess
def get_data_from_git(format_string, commit):
return subprocess.check_output(['git', 'log', '-1', '--format=format:%s' % format_string, commit])
def get_author(commit):
return get_data_from_git('%an <%ae>', commit)
import httplib, json
import getopt, sys, os
import subprocess
def get_data_from_git(format_string, commit):
return subprocess.check_output(['git', 'log', '-1', '--format=format:%s' % format_string, commit])
def get_author(commit):
return get_data_from_git('%an', commit)
@mberrueta
mberrueta / git-recover-branch.md
Created September 21, 2017 20:56 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@mberrueta
mberrueta / bin-squash_migrations
Created May 10, 2018 15:27 — forked from bf4/bin-squash_migrations
Squash Rails migrations in this one easy step
#!/usr/bin/env bash
git ls-files db/migrate/*.rb | sort | tail -1 | \
ruby -e "schema_version=STDIN.read[/\d+/]; init_schema=%(db/migrate/#{schema_version}_init_schema.rb);
%x(git rm -f db/migrate/*.rb;
mkdir db/migrate;
git mv db/schema.rb #{init_schema};
rake db:migrate;
git add db/schema.rb; git commit -m 'Squashed migrations')"
@mberrueta
mberrueta / Dokerfile
Last active October 20, 2018 18:50
InsecureProgramming
FROM debian:stable
RUN apt update
RUN apt install -y git gcc gcc-multilib g++-multilib python vim gdb
# RUN sysctl -w kernel.randomize_va_space=0 # disable secuty flags
RUN git clone https://github.com/gerasdf/insecureProgramming/
WORKDIR /insecureProgramming/exercises/
# copy Host to container ADD /my_app_folder /my_app_folder
Getting the list of rows per table
```
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
```
search_columns
```
@mberrueta
mberrueta / Dockerfile
Last active December 9, 2022 11:12
cardano-node Docker
FROM debian
# # https://developers.cardano.org/docs/get-started/installing-cardano-node/
# Installing Operating System dependencies​
RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \
@mberrueta
mberrueta / installing-emacs-from-source-on-debian.txt
Created February 2, 2024 03:02 — forked from zoliky/installing-emacs-from-source-on-debian.txt
Installing Emacs 29.1 from source on Debian 12
Installation
------------
1. Install the build dependencies for Emacs:
$ sudo apt build-dep emacs
$ sudo apt install libtree-sitter-dev
2. Download and unpack the Emacs archive: