Skip to content

Instantly share code, notes, and snippets.

@D3f0
D3f0 / local_settings_helper.py
Created December 16, 2016 19:00
Access directly to Heroku app DBs from your shell
# This snippet requires dj_database_url (https://github.com/kennethreitz/dj-database-url)
class HerokuDatabaseWrapper(dict):
def get_config_for_app(self, name):
from subprocess import check_output
d = {}
output = check_output('heroku config -a'.split() + [name, ])
for line in output.split('\n'):
if ':' not in line:
@D3f0
D3f0 / analizar.py
Last active October 27, 2016 01:58
parser linea iptables LOG
# Esqueleto para port knocker (Administración de Redes y Seguridad 2016)
# iptables -A INPUT -j LOG
# ejecutar script con sudo
# Probar en Ubntu, ya que CORE no tiene /var/log/syslog
import re
import subprocess
def converit_a_dict(linea):
tmp = {}
@D3f0
D3f0 / gif2pngzip.sh
Last active June 2, 2016 15:44
Convertir GIF a archivos PNG comprimidos (para mayor desempeño de KIVY)
#!/bin/bash
# Uso: gif2pngzip.sh ARCHIVO.GIF [ARCHIVO2.GIF]
if ! which convert 1>/dev/null 2>/dev/null; then
echo "Falta instalar imagemagick"
exit 1
fi
@D3f0
D3f0 / download_reveal_python_cell.py
Last active March 26, 2016 19:24
Download Reveal for Jupyter/IPython slides
%%bash
test -e reveal.js || {
wget https://github.com/hakimel/reveal.js/archive/3.2.0.zip -O /tmp/reveal.zip
unzip /tmp/reveal.zip
mv reveal.js-* reveal.js
rm /tmp/reveal.js
}
@D3f0
D3f0 / debugger_arduino.cpp
Last active December 13, 2015 22:04
Reemplazando printf
class Dbg
{
public:
// Operador () con cadenas
Dbg& operator()(char const *s){
//printf("%s ", s);
Serial.print(s);
Serial.print(" ");
return *this;
// Quizás la API Serial y Ethernet podrían compartir algo
MaraCommandReceiver commandReceiver;
void loop(){
// Create a client connection
EthernetClient client = server.available();
if (client) {
while (client.connected()) {
if (client.available()) {
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
import pilasengine
pilas = pilasengine.iniciar()
class Escena_Menu(pilasengine.escenas.Escena):
"Es la escena que muestra el menu"
# El texto anterior sera interpretado por Phyton para armar la
# documentacion de la clase
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.