Skip to content

Instantly share code, notes, and snippets.

View gionniboy's full-sized avatar
🩸
🙅 🚗 ⛰️ 🔽

Giovanni Pullara gionniboy

🩸
🙅 🚗 ⛰️ 🔽
View GitHub Profile
#!/bin/bash
cd $1
echo Pulling branches
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
echo Cleaning
for BRANCH in $(git branch --merged| egrep -v "(^\*|master|develop)")
do
git branch -d $BRANCH
git push --delete origin $BRANCH

Debugging Python within Docker

Often you need to run debugger within docker. It many cases it looks like this:

import pdb; pdb.set_trace()

Or:

@gionniboy
gionniboy / ecs.py
Created December 11, 2019 02:43 — forked from schlarpc/ecs.py
from troposphere import \
AWSHelperFn, Base64, Cidr, Condition, Equals, GetAtt, Join, Not, Output, Parameter, Ref, \
Region, Select, Split, StackName, Sub, Tags, Template
from troposphere.autoscaling import \
AutoScalingGroup, LaunchTemplateSpecification, LifecycleHookSpecification
from troposphere.awslambda import \
Code, Function, Permission
from troposphere.ec2 import \
CreditSpecification, IamInstanceProfile, InternetGateway, LaunchTemplate, LaunchTemplateData, \
Route, RouteTable, SecurityGroup, SecurityGroupRule, Subnet, SubnetRouteTableAssociation, VPC, \
@gionniboy
gionniboy / arch-linux-install
Created September 29, 2019 04:57 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@gionniboy
gionniboy / actionlist.vim
Created September 4, 2019 14:12 — forked from zchee/actionlist.vim
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
#!/bin/bash
set -o errexit
set -o nounset
echo "Configuring psql with improved performance..."
sed -ri "s/^#*(fsync\s*=\s*)\S+/\1 off/" "$PGDATA"/postgresql.conf
sed -ri "s/^#*(full_page_writes\s*=\s*)\S+/\1 off/" "$PGDATA"/postgresql.conf
sed -ri "s/^#*(random_page_cost\s*=\s*)\S+/\1 2.0/" "$PGDATA"/postgresql.conf
import logging
import requests
import contextlib
try:
from http.client import HTTPConnection # py3
except ImportError:
from httplib import HTTPConnection # py2
@gionniboy
gionniboy / README-Template.md
Created December 27, 2017 04:46 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@gionniboy
gionniboy / php7_build_dev.sh
Last active October 10, 2017 02:54
php7 build from source - for devuan jessie
#!/usr/bin/env bash
# php7 from source with xdebug support for php dev env
# install system dependecies TODO: CHECK
apt-get update
apt-get install
apt-get -y install build-essential autoconf insserv bison git
apt-get -y install libgmp-dev libmysqlclient-dev libfcgi-dev libfcgi0ldbl libmcrypt-dev \
libxml2-dev libxml2 libssl-dev libbz2-dev libcurl4-gnutls-dev libjpeg62-turbo-dev libjpeg-dev \
@gionniboy
gionniboy / recover_source_code.md
Created May 3, 2017 01:28 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb