Skip to content

Instantly share code, notes, and snippets.

View archatas's full-sized avatar

Aidas Bendoraitis archatas

View GitHub Profile
I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer.
I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc).
# Install rvm (no sudo!)
# ------------------------------------------------------
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
source ~/.rvm/scripts/rvm
rvm install ree-1.8.7-2010.02
@jcsrb
jcsrb / gist:1081548
Created July 13, 2011 23:05
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
@benoitbryon
benoitbryon / pep-0423.txt
Last active May 12, 2016 17:38
PEP 423: Naming conventions and recipes related to Python packaging
PEP: 423
Title: Naming conventions and recipes related to packaging
Version: $Revision$
Last-Modified: $Date$
Author: Benoît Bryon <benoit@marmelune.net>
Discussions-To: <distutils-sig@python.org>
Status: Deferred
Type: Informational
Content-Type: text/x-rst
Created: 24-May-2012
@gthomas
gthomas / gist:3452673
Created August 24, 2012 16:37
Python HMAC md5
#!/usr/bin/env python
from hashlib import md5
trans_5C = "".join(chr(x ^ 0x5c) for x in xrange(256))
trans_36 = "".join(chr(x ^ 0x36) for x in xrange(256))
blocksize = md5().block_size
def hmac_md5(key, msg):
if len(key) > blocksize:
key = md5(key).digest()
key += chr(0) * (blocksize - len(key))
@nguyenlocduy
nguyenlocduy / uri.js
Created September 7, 2012 09:26 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@todgru
todgru / bash.md
Last active December 11, 2015 12:39
bash
  • du -sh {directory} list display size of directory in human readable format.
  • du -sh * show size of each directory in the current path
  • df disk space usage
$ du -sh *
 11M  Applications
1.9G	Desktop
 14G	Documents
8.0K	Downloads
@ambivalentno
ambivalentno / login.html
Last active May 3, 2024 23:10
django-crispy-form with bootstrap for django-allauth login. Note: now (2014-08-05) you have to install master allauth from github to override forms.
{% load crispy_forms_tags %}
{% block content %}
{% crispy form %}
{% endblock %}
@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.
#!/bin/bash
#
find . -type f -name '*.py[co]' -delete
find . -type d -name '__pycache__' -delete
@bowenyang007
bowenyang007 / how_to_make_a_script.md
Created October 15, 2015 20:09 — forked from joshwyatt/how_to_make_a_script.md
How to make scripts you can access globally from the terminal

How to make a globally available executable script in the scripting language of your choice

  • Locate the path to the interpreter for the language you are writing in with the which command.

      which node
      which python
      which bash
      which ruby
    
  • Add that path as an interpreter directive (using #!) on the first line of your script. For example if you want to write a node script and which node returned /usr/local/bin/node, the first line of your script should be: