Skip to content

Instantly share code, notes, and snippets.

View tanrax's full-sized avatar

Andros Fenollosa tanrax

View GitHub Profile
@sergeyloysha
sergeyloysha / country_phone_codes.js
Created March 19, 2019 12:31
Country phone codes
export default {
AF: {
name: 'Afghanistan',
code: '+93'
},
AL: {
name: 'Albania',
code: '+355'
},
DZ: {
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@budparr
budparr / jekyll-collections-prev-next.html
Last active September 29, 2021 10:55
Previous Next Links for Jekyll Collections
{% capture the_collection %}{{page.collection}}{% endcapture %}
{% if page.collection %}
{% assign document = site[the_collection] %}
{% endif %}
<h1>TITLE: {{ page.title }}</h1>
{% for links in document %}
{% if links.title == page.title %}
{% unless forloop.first %}
{% assign prevurl = prev.url %}
{% endunless %}
@cleverdevil
cleverdevil / contacts.py
Last active May 31, 2022 12:03
Integrate Mac OS X Contacts database with mutt for auto-completion of email addresses
#!/usr/bin/env python
'''
A script to search the Mac OS X Address Book via PyObjC bridge, and
then output the results in a format suitable for integration with
mutt.
Add the following to your `.muttrc`:
set query_command = "~/.mutt/contacts.py '%s'"
@rboyd
rboyd / random-str.clj
Created February 28, 2013 03:30
random string (clojure)
(defn rand-str [len]
(apply str (take len (repeatedly #(char (+ (rand 26) 65))))))
@spicycode
spicycode / tmux.conf
Created September 20, 2011 16:43
The best and greatest tmux.conf ever
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
@pablorecio
pablorecio / models.py
Created August 31, 2011 06:31 — forked from anonymous/models.py
Avoid infinite signals when saving an object instance in Django's pre_save or post_save
from django.db.models.signals import post_save
from django.dispatch import receiver
# models definition here ...
@receiver(post_save, sender=MyModel)
def handler_that_saves_a_mymodel_instance(sender, instance, created, **kwargs):
# without this check the save() below causes infinite post_save signals
if created:
instance.some_field = complex_calculation()