Skip to content

Instantly share code, notes, and snippets.

View Gnappuraz's full-sized avatar
:octocat:
Doing stuff

Matteo Sumberaz Gnappuraz

:octocat:
Doing stuff
View GitHub Profile
@Gnappuraz
Gnappuraz / bitcoin_vm_setup.txt
Created May 6, 2019 12:46
Prepare bitcoin dev node
sudp apt-get update
sudo apt-get install -y build-essential libtool autotools-dev automake pkg-config bsdmainutils python3
sudo apt-get install -y libboost-system-dev libboost-filesystem-dev libboost-chrono-dev \
libboost-program-options-dev libboost-test-dev libboost-thread-dev parallel python
./contrib/install_db4.sh `pwd`
export BDB_PREFIX=$(pwd)'/db4'
./autogen.sh
./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" --enable-debug
make CFLAGS='-g -O0' CXXFLAGS='-g -O0 -std=c++11' -j12;
@Gnappuraz
Gnappuraz / pre-commit.sh
Last active October 11, 2018 14:06
Git pre-commit hook to run clang-format and linters from bitcoin
#!/bin/sh
script_dir="contrib/devtools"
files_to_commit=$(git diff-index --cached --name-only --diff-filter=d HEAD)
format_paths="src/esperanza src/snapshot"
for file in ${files_to_commit}
do
for path in $format_paths
do
@Gnappuraz
Gnappuraz / delete_all.sh
Created July 30, 2018 16:53
Delete all docker containers and images
#!/bin/bash
# Kill all running containers
docker kill $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@Gnappuraz
Gnappuraz / snakebite_autocompletion.sh
Created October 24, 2017 08:30
Autocompletion for Snakebite on Mac
_snakebite()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ ${prev} != "snakebite" ]]; then
local IFS=$'\t\n'
if [[ $cur != /* ]] ; then
@Gnappuraz
Gnappuraz / purge-old-lfs files
Created September 6, 2017 20:15
git remove old lfs files
git -c GIT_LFS_SKIP_SMUDGE=1 clone repo //clone a repo without downloading the files
// list all tracked files with git lfs (png, wav, mp3 especially)
// list for each file all the lfs versions
// run git filter on each file to point to the most recent one
git filter-branch --tree-filter 'sed -i "/old_pointer/new_pointer" filename' -- --all
// run a git lfs prune to remove the files not referenced anymore
@Gnappuraz
Gnappuraz / git-filter-branch-cleanup.txt
Last active September 6, 2017 19:38
Git filter-branch
Here's a good way to clean the repo up after filter-branch:
git remote rm origin
rm -rf .git/refs/original/ .git/refs/remotes/ .git/*_HEAD .git/logs/
git for-each-ref --format="%(refname)" refs/original/ | xargs -n1 --no-run-if-empty git update-ref -d
And then:
git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 \
-c gc.rerereunresolved=0 -c gc.pruneExpire=now gc "$@" --aggressive