Skip to content

Instantly share code, notes, and snippets.

View alexvicegrab's full-sized avatar

Sasha (Alejandro Vicente Grabovetsky) alexvicegrab

View GitHub Profile
import sys
from collections import OrderedDict
PY2 = sys.version_info[0] == 2
_internal_attrs = {'_backend', '_parameters', '_buffers', '_backward_hooks', '_forward_hooks', '_forward_pre_hooks', '_modules'}
class Scope(object):
def __init__(self):
self._modules = OrderedDict()
@JohannesBuchner
JohannesBuchner / rsyncprogress.py
Last active June 18, 2023 18:51
Progress bar for rsync
"""
Progress bar for rsync
========================
Shows file progress and total progress as a progress bar.
Usage
---------
Run rsync with -P and pipe into this program. Example::
@dhbradshaw
dhbradshaw / gist:e2bdeb502b0d0d2acced
Last active August 16, 2023 17:50
Rename field using migrations in django 1.7
To change a field name in django 1.7+
1. Edit the field name in the model (but remember the old field name: you need it for step 3!)
2. Create an empty migration
$ python manage.py makemigrations --empty myApp
3. Edit the empty migration (it's in the migrations folder in your app folder, and will be the most recent migration) by adding
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'),
to the operations list.
@ajmazurie
ajmazurie / starcluster-hostname
Last active September 9, 2016 11:30
Retrieve the hostname from an existing StarCluster cluster on the command-line
#!/bin/bash
if [[ $# != 1 ]]; then
echo "ERROR: a cluster name must be provided" 1>&2
exit 1
fi
cluster_meta="$(starcluster listclusters $1 2>&1)"
if [[ $? != 0 ]]; then
@koffeinfrei
koffeinfrei / README.md
Last active August 29, 2015 13:56
rails rake task for checking validity of all rails model entries

Put this file in your rails project at lib/tasks/db.rake. Use it like

$ rake db:data:validate
@postpostmodern
postpostmodern / rails_bootstrap_delete_confirmation_modal.md
Created February 19, 2012 07:38 — forked from trey/rails_bootstrap_delete_confirmation_modal.md
A nice delete confirmation modal in Rails courtesy of Bootstrap

Here's what you get.

Some CoffeeScript (verbosely commented for clarity)

# Override Rails handling of confirmation

$.rails.allowAction = (element) ->
  # The message is something like "Are you sure?"
  message = element.data('confirm')