Skip to content

Instantly share code, notes, and snippets.

View olistik's full-sized avatar

Maurizio De Magnis olistik

View GitHub Profile
@olistik
olistik / gist:3894072
Created October 15, 2012 18:09
Ubuntu 12.04 Terminator config: solarized theme + iTerm2-like key bindings
# place this file in ~/.config/terminator/config
[global_config]
title_transmit_bg_color = "#d30102"
focus = system
[keybindings]
reset_clear = <Ctrl>R
new_tab = <Ctrl>T
split_horiz = <Ctrl><Shift>E
split_vert = <Ctrl>E
close_term = <Ctrl><Shift>W
@olistik
olistik / gist:2627011
Last active August 12, 2021 06:39
Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Ubuntu 12.10 setup (rbenv/RVM, Janus, PostgreSQL)

Basic pre-requisites

  • Some utilities:
sudo apt-get install vim tmux git curl
  • Copy/paste from the command line:
@olistik
olistik / README.md
Last active August 22, 2017 14:05
Starts and stops Puma using `wait` to wait for the process to quit

I made this because I'm not comfortable relying only on a check of the existence of a process associated with the PID contained in the PID file. I know that exhausting the PID stack is highly unlikely but it's not impossible and I like to make fewer assumptions.

You can spawn Puma with ./spawn.sh and in another shell, simulate a stop with ./stop.sh. After the Puma process stops, a "gate file" gets created, simulating the notification of the end of the process. Using the gate file it's possible to wait for its creation right after having sent the SIGTERM signal but other type of notifications are possible.

I tested this code on OpenBSD 6.1 amd64.

@olistik
olistik / geo-distance--haversine.rb
Created April 26, 2017 07:50
Haversine formula to calculate the distance between two points.
module Geo
class Point
attr_accessor :latitude, :longitude
def initialize(latitude:, longitude:)
self.latitude = latitude
self.longitude = longitude
end
end
def self.radians(degrees)
@olistik
olistik / config
Created October 4, 2012 13:30
terminator config with solarized theme
# place this file in ~/.config/terminator/config
[global_config]
title_transmit_bg_color = "#d30102"
focus = system
[keybindings]
[profiles]
[[default]]
palette = "#073642:#dc322f:#859900:#b58900:#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:#839496:#6c71c4:#93a1a1:#fdf6e3"
background_color = "#eee8d5"
foreground_color = "#002b36"
@olistik
olistik / .screenrc
Created November 23, 2012 10:44
Use Screen's text reflow within Terminator
# put the following line into ~/.screenrc (create it if it doesn't exist)
startup_message off
@olistik
olistik / README.md
Last active September 7, 2016 12:51
DatoCMS debugging session.

Steps

  1. I'm editing a record of the Entity Type "Item" link
  2. I fill the id field with the value "scuolase"
  3. I click the "Save Item" button
  4. I see the flash message "Item succesfully updated"
  5. The "Save Item" button stays clickable (with the active color)
  6. When I perform a full refresh of the page, the id field is blank instead of containing the value "scuolase"

HAR dumps

@olistik
olistik / ansible__make-webdocs--error.log
Last active September 2, 2016 20:22
Ansible: can't build documentation from sources because of error `ValueError: unknown locale: UTF-8`.
devel ⎋ make webdocs
(cd docsite/; make docs)
rm -rf htmlout
rm -f .buildinfo
rm -f *.inv
rm -rf *.doctrees
Cleaning up minified css files
find . -type f -name "*.min.css" -delete
Cleaning up byte compiled python stuff
find . -regex ".*\.py[co]$" -delete
@olistik
olistik / ansible_make-webdocs--error.log
Last active September 2, 2016 19:49
Ansible: can't `make webdocs`.
devel ⎋ uname -a
Darwin titan.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
devel ⎋ ls
CHANGELOG.md Makefile ansible-core-sitemap.xml docsite setup.py
CODING_GUIDELINES.md README.md bin examples shippable.yml
CONTRIBUTING.md RELEASES.txt contrib hacking test
COPYING ROADMAP.rst docs lib ticket_stubs
MANIFEST.in VERSION docs-api packaging tox.ini
devel ⎋ git show --name-status
commit 67177105e3c1bc0b0d44c58155c56ae0e4d6fdb2

Keybase proof

I hereby claim:

  • I am olistik on github.
  • I am olistico (https://keybase.io/olistico) on keybase.
  • I have a public key whose fingerprint is 157F 3C55 3BF5 04F6 7DFA 590D 1750 B328 C513 86AC

To claim this, I am signing this object: