Skip to content

Instantly share code, notes, and snippets.

View olistik's full-sized avatar

Maurizio De Magnis olistik

View GitHub Profile
@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 / 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:

@olistik
olistik / link-progetti-desio.md
Last active May 31, 2016 16:04
Lista di link di utilità per i progetti Desio Dal Vivo, ECDM e Open Desio (https://bit.ly/progetti-desio)
```
gem install hanami
hanami new bookshelf
cd bookshelf && bundle
git add . && git commit -m "Initial commit"
heroku apps:create
heroku config:add BOOKSHELF_DATABASE_URL="file:///db/bookshelf"
git push heroku master
```
  1. Quali dei seguenti strumenti possiedi?
  • Computer fisso a casa
  • Computer portatile a casa
  • Computer fisso al lavoro
  • Computer portatile al lavoro
  • Connessione Internet a casa
  • Connessione Internet al lavoro
  • Rete Wi-Fi al lavoro
  • Smartphone/tablet
  1. Possiedi un indirizzo e-mail personale?
foo bar