Skip to content

Instantly share code, notes, and snippets.

View berga's full-sized avatar

Marco Bergantin berga

  • TIM - Gruppo Telecom Italia
  • Cagliari, Italy
View GitHub Profile
@berga
berga / Remove all git tags
Created October 20, 2016 12:06 — forked from okunishinishi/Remove all git tags
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@berga
berga / migrate_postgresql_database.md
Created February 24, 2017 12:39 — forked from olivierlacan/migrate_postgresql_database.md
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X

This guide assumes that you recently run brew upgrade postgresql and discovered to your dismay that you accidentally bumped from one major version to another: say 9.3.x to 9.4.x. Yes, that is a major version bump in PG land.

First let's check something.

brew info postgresql

The top of what gets printed as a result is the most important:

@berga
berga / keybase.md
Created May 22, 2017 10:01
Keybase proof

Keybase proof

I hereby claim:

  • I am berga on github.
  • I am berga (https://keybase.io/berga) on keybase.
  • I have a public key ASAssUJ8HJJrWYtbp9GhTzYLqB5UwAmEshZB6JJrT7pvEQo

To claim this, I am signing this object:

@berga
berga / Vagrantfile
Created February 8, 2018 15:18 — forked from creisor/Vagrantfile
Vagrant file for installing ruby with rbenv
# -*- mode: ruby -*-
# vi: set ft=ruby :
RUBY_V = File.open("./.ruby-version") { |f| f.read }.chomp
$apt_script = <<SCRIPT
sudo apt-get update
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev libmysqlclient-dev
SCRIPT
@berga
berga / doit
Created September 27, 2018 21:44 — forked from stantonk/doit
Install python 2.7.3 on CentOS 5.8
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
yum groupinstall "Development tools"
yum install zlib-devel
yum install bzip2-devel openssl-devel ncurses-devel
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
tar xf Python-2.7.3.tar.bz2
cd Python-2.7.3
@berga
berga / _upgrade-pg9.4-to-pg9.5.md
Created December 11, 2018 23:15 — forked from chbrown/_upgrade-pg9.4-to-pg9.5.md
Upgrade PostgreSQL 9.4 to 9.5 on Mac OS X with Homebrew

First, check your current config (example output in homebrew.mxcl.postgresql.plist.xml lower down in this gist):

cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Most importantly, note the -D /usr/local/var/postgres argument.

Second, shut down your current PostgreSQL.

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
#############################
### GENERATE CERT AND KEY ###
#############################
# when generating key and cert, use password provided by administrator
cd ~/Workspace/Silvermedia/vpn
kozak127@callisto:~/Workspace/Silvermedia/vpn$ openssl pkcs12 -in michal.wesoly.p12 -nocerts -nodes -out michal.wesoly.key
Enter Import Password:
@berga
berga / gist:6683bb2c3c36531a2762f963ad882eaa
Created April 5, 2019 08:33 — forked from qsun/gist:1247402
ruby integer to/from ip address
require 'ipaddr'
IPAddr.new('1.2.3.4').to_i
IPAddr.new(16909060, Socket::AF_INET).to_s
@berga
berga / rbenv-install-system-wide.sh
Last active April 24, 2019 01:42 — forked from jnx/rbenv-install-system-wide.sh
rbenv install and system wide install on Ubuntu 16.04 LTS.
# Update, upgrade and install development tools:
apt update
apt -y upgrade
apt -y install build-essential git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
echo '# rbenv setup' > /etc/profile.d/rbenv.sh
@berga
berga / uiwebview_snippet.js
Created February 1, 2018 12:54 — forked from chrisallick/uiwebview_snippet.js
JavaScript only solution for detecting UIWebView.
// http://stackoverflow.com/questions/4460205/detect-ipad-iphone-webview-via-javascript
var standalone = window.navigator.standalone,
userAgent = window.navigator.userAgent.toLowerCase(),
safari = /safari/.test( userAgent ),
ios = /iphone|ipod|ipad/.test( userAgent );
if( ios ) {
if ( !standalone && safari ) {
//browser
} else if ( standalone && !safari ) {