Skip to content

Instantly share code, notes, and snippets.

View gabamnml's full-sized avatar
:electron:
Focusing

Gabriel Aramburu gabamnml

:electron:
Focusing
View GitHub Profile
@gabamnml
gabamnml / Python SimpleHTTPServer with SSL
Created November 4, 2017 01:19 — forked from rozifus/Python SimpleHTTPServer with SSL
Python SimpleHTTPServer with SSL
# useful for running ssl server on localhost
# which in turn is useful for working with WebSocket Secure (wss)
# copied from http://www.piware.de/2011/01/creating-an-https-server-in-python/
@gabamnml
gabamnml / gist:3895646
Created October 15, 2012 21:29
tunnel SSH for port 8080 HTTP
ssh -D 8080 -f -C -q -N myuser@myserver.com
@gabamnml
gabamnml / gist:4532176
Created January 14, 2013 18:30
socket.io config for production
io.configure('production', function(){
console.log("Running Socket.io in production mode");
io.enable('browser client minification'); // send minified client
io.enable('browser client etag'); // apply etag caching logic based on version number
io.enable('browser client gzip'); // gzip the file
io.set('log level', 1); // reduce logging
io.set('transports', [ // enable all transports (optional if you want flashsocket)
'websocket'
, 'flashsocket'
, 'htmlfile'
@gabamnml
gabamnml / redis_and_resque.mkd
Created April 26, 2016 18:36 — forked from Diasporism/redis_and_resque.mkd
How to configure Redis and Resque for your Rails app.

Redis and Resque

What this guide will cover: the code you will need in order to include Redis and Resque in your Rails app, and the process of creating a background job with Resque.

What this guide will not cover: installing Ruby, Rails, or Redis.

Note: As of this writing I am still using Ruby 1.9.3p374, Rails 3.2.13, Redis 2.6.11, and Resque 1.24.1. I use SQLite in development and Postgres in production.

Background jobs are frustrating if you've never dealt with them before. Over the past few weeks I've had to incorporate Redis and Resque into my projects in various ways and every bit of progress I made was very painful. There are many 'gotchas' when it comes to background workers, and documentation tends to be outdated or scattered at best.

@gabamnml
gabamnml / gist:3afa9f453c48e51c2dc4be8de65e1aa3
Created December 6, 2016 18:53 — forked from dhbradshaw/gist:e2bdeb502b0d0d2acced
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.

Keybase proof

I hereby claim:

  • I am gabamnml on github.
  • I am aramburu (https://keybase.io/aramburu) on keybase.
  • I have a public key whose fingerprint is BEE6 5C9B 7555 0DCF 90EF 283F 63CB 06F8 A598 BA42

To claim this, I am signing this object:

@gabamnml
gabamnml / fase 3 marvel
Created May 14, 2016 21:15
Fase 3 de marvel
Capitán América: Civil War – 6 de mayo el año 2016
Doctor Extraño – 4 de noviembre el año 2016
Guardianes de la Galaxia, vol. 2 – 5 de mayo de, 2017
Spider-Man: Homecoming – 7 julio 2017
Thor: Ragnarok – 3 noviembre 2017
get '/blog*' do
begin
path = params[:splat][0]
source_url = URI.parse('http://asdf.tumblr.com' + path.gsub(/ /, '+'))
source_content_type = ''
source_body = open(source_url) do |f|
source_content_type = f.content_type
f.read
end
# The upstream server doesn't need a prefix! no need for wss:// or http:// because nginx will upgrade to http1.1 in the config below
upstream yeomanserver {
server localhost:3000;
}
server {
listen 443;
server_name legionofevil.org;
root html;
// UTF8 Module
//
// Cleaner and modularized utf-8 encoding and decoding library for javascript.
//
// copyright: MIT
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com
(function (name, definition, context, dependencies) {
if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); }
else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); }
else { context[name] = definition.apply(context); }