Skip to content

Instantly share code, notes, and snippets.

View balkian's full-sized avatar
🏠
Working from home

J. Fernando Sánchez balkian

🏠
Working from home
View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCrrhualyEa46fNvKDlspg2u2irEjYZFl0LS6eAcRe6QmY35JWyTqOvwqOuxREhhpqh/pFZgNLto/sUpwthTILvP+1vG2/JFxspdJiwZxoudQr9qMi5raM96WPIDFFXGVao9pgidAxrexm2Ld9zwU6p0ztGn0VZ9OSyNavEB664lUk+pQXKZ9Ax6TmBy7Tdfs+pRBqRQRpp9yKKq7PzXrPq8Wi1UNuxoKc0KIdIhvMJkt7wyTYXixHjQz2M141zEn4+Gkc5l/ceL/0dSxH3qiJbzs9HOGQIUdxy//urbAlYl31olPvVCoqyDwb7AbTXGGAQ1zcxd+5PkC/RdYJu1rYf jfernando@jfernando-xps
@balkian
balkian / adduser.sh
Created October 10, 2015 21:52
Add user to Dokku
cat ~/.ssh/id_rsa.pub | ssh root@<domain> "sudo sshcommand acl-add dokku <description>"
#Description can be anything (e.g. your user name or location
@balkian
balkian / dns.py
Last active October 20, 2015 10:47
DNS server that adds a record for every running docker container
# -*- coding: utf-8 -*-
from __future__ import print_function
try:
from subprocess import getoutput
except ImportError:
from commands import getoutput
from dnslib import RR,QTYPE,RCODE,A,parse_time
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# http://haproxy.1wt.eu/download/1.4/doc/configuration.txt
#
#---------------------------------------------------------------------
global
log 127.0.0.1 local2
@balkian
balkian / Dockerfile
Last active November 1, 2015 18:52
Deploying a static website in heroku without extra plugins
FROM nginx
EXPOSE 80
ADD . /usr/share/nginx/html/
@balkian
balkian / custom_palette.py
Created November 8, 2015 18:19
Matplotlib tricks
from matplotlib.pyplot import cm
color=cm.rainbow(np.linspace(0,1,len(emotions)))
color = dict(zip(emotions, color))
color
@balkian
balkian / htaccess
Created December 3, 2015 10:14
Apache tricks
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
SCL - D1
SDA - D2
from __future__ import print_function
import csv
from jinja2 import Template
with open('PC Members.tsv') as f:
contacts = csv.DictReader(f, delimiter='\t')
with open('index.j2') as templatefile:
template = Template(templatefile.read())
swagger: "2.0"
info:
version: 0.1.0
title: SCANER API
license:
name: MIT
url: http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
securityDefinitions: {}
consumes:
- application/json