Skip to content

Instantly share code, notes, and snippets.

View llazzaro's full-sized avatar
👨‍🚒
Fighting fire with fire 🔥

Leonardo Lazzaro llazzaro

👨‍🚒
Fighting fire with fire 🔥
View GitHub Profile
#!/bin/bash
set -o errexit
# ---------------UPDATE ME-------------------------------#
# Increment me any time the environment should be rebuilt.
# This includes dependncy changes, directory renames, etc.
# Simple integer secuence: 1, 2, 3...
environment_version=39
#--------------------------------------------------------#

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@llazzaro
llazzaro / ejercicio_b.hs
Created July 19, 2014 23:29
Ejercicio de Parcial Haskell
encontrarMinimo :: Perm a -> a -> Integer
encontrarMinimo permutacion x0 = foldr (\x rec -> if ((aplicarNVeces permutacion x0 x)== x0) then rec else rec + 1) 0 [0..]
ciclo :: Eq a => Perm a -> a -> a -> [a]
ciclo p inicial = [aplicarNVeces p inicial x| x <- [0..(encontrarMinimo p inicial)]]
aplicarNVeces :: Perm a -> a -> Int -> a
aplicarNVeces p x0 x = foldr (\x rec -> (p rec)) x0 [0..x]
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
root@OpenWrt:~# cat /etc/config/network
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'lan'
option 'ifname' 'eth0.1'
option 'type' 'bridge'
@llazzaro
llazzaro / shell.py
Last active August 29, 2015 14:03 — forked from samv/shell.py
"""
The SQLAlchemy Shell.
This is just a wrapper for code.InteractiveConsole with some useful
defaults for using SQLAlchemy
"""
import sys
from IPython import embed
@llazzaro
llazzaro / fabric_pgdump_all.py
Last active August 29, 2015 14:03
Fabric script for Postgres backup
import os
import time
from fabric.contrib.files import exists
from fabric.api import (
env,
require,
run,
get,
sudo
@llazzaro
llazzaro / fabric_backup_mysql.py
Created June 25, 2014 12:42
Fabric script for mysql backup
import time
def vps():
env.hosts = ['apps.myvps.com']
env.user = 'app'
env.dbname = 'blog'
env.dbuser = 'blogger'
env.dbpass = 'password'
def backup():
# Manually download APP-SDK from here: http://developer.amd.com/tools-and-sdks/opencl-zone/opencl-tools-sdks/amd-accelerated-parallel-processing-app-sdk/
mkdir AMD-APP-SDK-lnx64
cd AMD-APP-SDK-lnx64/
tar -zxvf AMD-APP-SDK-v2.9-lnx64.tgz
sudo ./Install-AMD-APP.sh
sudo apt-get install libssl-dev build-essential python-dev libpcap-dev
export AMDAPPSDKROOT="/opt/AMDAPP"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"/opt/AMDAPP/lib/x86_64":"/opt/AMDAPP/lib/x86"
@llazzaro
llazzaro / gist:3353a8add5d9f7fea918
Created June 21, 2014 17:16
Share Internet with Debian
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -F FORWARD
iptables -A FORWARD -j ACCEPT
apt-get install dnsmasq
printf " interface=eth0\ndhcp-range=192.168.10.10,192.168.10.19,4h" >> file.txt
/etc/init.d/dnsmasq restart
ifconfig eth0 192.168.10.1 netmask 255.255.255.0