Skip to content

Instantly share code, notes, and snippets.

View olistik's full-sized avatar

Maurizio De Magnis olistik

View GitHub Profile
@PaulKinlan
PaulKinlan / getdeviceart.sh
Last active May 26, 2022 11:20
Screen Record for Android
#! /bin/bash
mkdir -p ./backgrounds
function get_google_device_art {
local device=$1
# Get the Google Device backgrounds
curl "https://developer.android.com/distribute/marketing-tools/device-art-resources/$1/port_back.png" > "./backgrounds/$1_port_back.png"
curl "https://developer.android.com/distribute/marketing-tools/device-art-resources/$1/port_fore.png" > "./backgrounds/$1_port_fore.png"
@olivierlacan
olivierlacan / migrate_postgresql_database.md
Last active March 24, 2022 20:30
How to migrate a Homebrew-installed PostgreSQL database to a new major version (9.3 to 9.4) on OS X. See upgraded version of this guide: http://olivierlacan.com/posts/migrating-homebrew-postgres-to-a-new-version/

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:

@edubkendo
edubkendo / atom_opal.md
Last active April 19, 2018 05:09
Writing Atom Plugins in Opal (Ruby)

I want to write plugins for Atom's editor in Ruby. Opal makes this possible. Atom is one of several projects in recent times to combine Chromium with Node.js for a desktop app. While it utilizes chromium for it's gui, and boasts "[e]very Atom window is essentially a locally-rendered web page", writing Atom plugins is more like writing a server-side node.js app than a typical single-page client-side app (albeit with really awesome integration with Chrome Devtools). Opal development, on the other hand, has to-date been focused primarily on the browser use-case.

Because of this, I had to make a choice between using the opal-node package from npm, using Opal via Ruby w/ a compile step, or packaging up opal-parser.js, including it with the app, and writing in compilation on the fly. Each choice came with compromises. Using opal-node would have been easiest, just create a top level index.coffee that required opal-node, and then require in your ruby

@jodosha
jodosha / Gemfile
Last active January 4, 2016 08:19
Example of Lotus::Router usage. It includes integration and unit tests examples. Clone this gist and then run `bash setup.sh` to run the app: `rackup application.rb`.
source 'https://rubygems.org'
gem 'lotus-router'
group :test do
gem 'rspec'
gem 'capybara'
end
@olistik
olistik / gist:5028679
Last active December 14, 2015 04:29
GIT prompt
function set_git_ruby_prompt {
local branch
branch=$(git branch --no-color 2> /dev/null | grep '*' | cut -c 3-)
if [ "$branch" ]; then
BGP_GIT_ROOT_DIRECTORY=$(git rev-parse --show-toplevel)
project=`basename ${BGP_GIT_ROOT_DIRECTORY}`
# ruby_interpreter=`rvm info ruby | grep " version" | cut -c 19- | sed -e 's/"//g'`
# rvm_gemset=`rvm info environment | grep gemset | cut -c 19- | sed -e 's/"//g'`
git_info=`git status --porcelain | cut -c -2`
@olistik
olistik / gist:5025558
Created February 24, 2013 20:45
Princìpi di Democrazia efficiente

Princìpi di democrazia efficiente

Localizzazione geografica

Reperire informazioni e ragionare su un territorio diventa più complesso all'aumentare delle dimensioni dello stesso.

Localizzazione del settore

Decisioni che tangono N settori vengono analizzate più efficientemente da gruppi di persone la cui professionalità riguarda principalmente quegli N settori.

@francescoagati
francescoagati / stream.rb
Created November 4, 2012 16:53
celluloid streaming content and write to mysql db
class Writer
include Celluloid
include Celluloid::Logger
def write_tweet(tweet)
DB[:links].insert(tweet)
end
@olistik
olistik / gist:3904477
Created October 17, 2012 08:44
My Ubuntu Opinions (12.10)

My Ubuntu Opinions (12.10)

Show every indicator (not working)

12.04 solution

dconf-editor -> com -> canonical -> Unity -> Panel -> systray-whitelist = "['all']"

@olistik
olistik / gist:3899771
Created October 16, 2012 14:53
Sublime Text 2 -> Resesif color scheme
cd ~/.config/sublime-text-2/Packages
git clone git://github.com/sonereker/resesif.tmbundle.git

Sublime Text 2 -> Preferences -> Color Scheme -> Reserif...

@olistik
olistik / gist:3899721
Created October 16, 2012 14:43
Ubuntu 12.04 mac-like keyboard

Ubuntu 12.04 mac-like keyboard

Layout

  • Italian: Settings -> Keyboard Layout -> Italian
  • options -> Alt/Win key behavior: "Control is mapped to Win Keys (and the usual Ctrl keys)"

System

  • launch web browser: cmd + alt + y