Skip to content

Instantly share code, notes, and snippets.

View gipi's full-sized avatar
😎
code for food

Gianluca Pacchiella gipi

😎
code for food
View GitHub Profile
@gipi
gipi / CERTIFICATES.md
Last active April 28, 2016 19:11
#rsa #certificate

Create a new key and certificate request

$ openssl req -new -newkey rsa:2048 -keyout example.com -nodes -out example.com.csr

or create a certificate request with a given key

$ openssl req -new -key example.com -out example.com.csr

finally self sign the certificate

@gipi
gipi / random.md
Last active August 29, 2015 13:57
Random link
@gipi
gipi / deploy_lib.sh
Created February 10, 2014 11:21
Simple bash utility functions to deploy heroku-like
#
# Simple utility script to manage deploy from client/server side
#
# usage:
#
# $ source deploy_lib.sh "/path/to/web/root"
# $ deploy
#
test -z "$1" && {
@gipi
gipi / 00.md
Last active December 25, 2015 23:59
#docker
sudo docker history 4ac367d7de27
IMAGE               CREATED             CREATED BY                                      SIZE
4ac367d7de27        5 months ago        /bin/sh -c #(nop) CMD [-D]                      0 B
0c5139bbc002        5 months ago        /bin/sh -c #(nop) ENTRYPOINT [/usr/sbin/sshd]   0 B
61ad8a4bf0c9        5 months ago        /bin/sh -c #(nop) EXPOSE map[22/tcp:{}]         0 B
afabbd8c9179        5 months ago        /bin/sh -c apt-get update &&  apt-get install   27.18 MB
9007a7d2fed0        5 months ago        /bin/sh -c echo "root:root" | chpasswd &&  mk   601 B
d3324a52f520        5 months ago        /bin/sh -c #(nop) ENV DEBIAN_FRONTEND=noninte   0 B
94f49c0773fc        5 months ago        /bin/sh -c #(nop) MAINTAINER Carl X. Su <bcbc   0 B
#!/usr/bin/env python
# inspired from <http://stackoverflow.com/questions/5821125/how-to-plot-confusion-matrix-with-string-axis-rather-than-integer-in-python>
import matplotlib.pyplot as plt
import numpy as np
import string
import sys
def generate_matrix_from_bigrams(bi):
@gipi
gipi / build.gradle
Last active December 20, 2015 19:19
#gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
@gipi
gipi / find_difference.py
Created May 24, 2013 19:48
dpkg -l between servers and compare them (work in progress)
#!/usr/bin/env python
pkg_a = {}
pkg_b = {}
def create_pkg_list(a):
pkg = {}
with open(a) as f:
for line in f.readlines():
component = filter(lambda x: x != '', line.split(' '))
@gipi
gipi / repo-apply.sh
Last active April 4, 2023 05:10
Split a patch created with repo diff in a set of usable patches
#!/bin/sh
## Script to patch up diff reated by `repo diff`
# from https://groups.google.com/d/msg/repo-discuss/43juvD1qGIQ/7maptZVcEjsJ
if [ -z "$1" ] || [ ! -e "$1" ]; then
echo "Usages: $0 <repo_diff_file>";
exit 0;
fi
rm -fr _tmp_splits*
@gipi
gipi / scan2djvu.sh
Created January 11, 2013 14:47
Create #DJVU from #JPEG images
#!/bin/bash
# http://www.howtoforge.com/creating_djvu_documents_on_linux
DPI=300
if [ $# -lt 2 ]
then
echo "usage: $0 root"
exit 1