Skip to content

Instantly share code, notes, and snippets.

Generated private key

openssl genrsa -out server.key 2048

To generate a certificate

openssl req -new -x509 -key server.key -out server.pem -days 3650

https

@illucent
illucent / run.py
Created March 3, 2016 16:43 — forked from alfredodeza/run.py
Serve a WSGI application + static files with CherryPy
import os
import cherrypy
from cherrypy import wsgiserver
from my_wsgi_app import wsgi
PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'public'))
class Root(object):
@illucent
illucent / ArchLinux-USB-Powersave.md
Created February 28, 2016 15:43 — forked from petarov/ArchLinux-USB-Powersave.md
Arch Linux Hints and Tricks

Mouse and Keyboard power off

Do you use an usb mouse and keyboard and have laptop_mode installed under your Arch linux ? Then maybe you have the same problems as me - mouse and keyboard getting inactive every 2 seconds or so.

To solve this, go to /etc/laptop-mode/conf.d and copy usb-autosuspend.conf to /etc/laptop-mode/conf.d/board-specific. After that run lsusb and get the ID of the usb device you want, e.g., 093a:2500 .

Open the board-specific/usb-autosuspend.conf file and find the AUTOSUSPEND_USBID_BLACKLIST conf option. Put the desired usb IDs there. You might need to run sudo laptop_mode afterwards to reload the configs.

@illucent
illucent / gist:782f9f672d903ee99851
Created February 26, 2016 11:43 — forked from wikimatze/gist:9790374
Github Two-Factor Authentication Failed For HTTPS

I heard from GitHub Two-Factor Authentication](https://github.com/blog/1614-two-factor-authentication) nearly a couple of days ago when I was reading my RSS feed. I enabled it and couldn' push to any of my repositories anymore. Learn in this blog post how to fix it.

Two-Factor Authentication

"Is a process involving two stages to verify the identity of an entity trying to access services in a computer or in a network". Github solves this authentication with sending an SMS to a device which wants to push to their platform.

Enabling Two-Factor Authentication

@illucent
illucent / selfhealing.py
Created February 19, 2016 09:39 — forked from madflojo/selfhealing.py
Self Healing Example Script
#!/usr/bin/python
import sys
import yaml
import rethinkdb as r
from rethinkdb.errors import RqlDriverError, RqlRuntimeError
import socket
import time
# Load Configuration
@illucent
illucent / gunicorn_start.bash
Created February 8, 2016 18:31 — forked from postrational/gunicorn_start.bash
Example of how to set up Django on Nginx with Gunicorn and supervisordhttp://michal.karzynski.pl/blog/2013/06/09/django-nginx-gunicorn-virtualenv-supervisor/
#!/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
@illucent
illucent / encoding-tips.sh
Created February 8, 2016 18:27 — forked from rponte/encoding-tips.sh
converting encoding with iconv command
# verifica encoding do arquivo
$ file -I script_perebento.sql
$ file -bI script_perebento.sql
# converte arquivo de ISO-8859-1 para UTF-8
$ iconv -f ISO-8859-1 -t UTF-8 script_perebento.sql > script_bonitao.sql
@illucent
illucent / gist:61c05a4892b7bc289128
Created February 7, 2016 11:42 — forked from rugor/gist:5422841
JavaScript: jQuery desaturate an image using HTML5 canvas and fade in on window load #rugor #st
$(window).load(function(){
$('.image-class').each(function(){
this.src = grayscale(this.src);
});
$('.image-class').fadeIn(500);
});
function grayscale(src){
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
@illucent
illucent / GeoLocator-sim.py
Created February 5, 2016 20:30 — forked from tckb/GeoLocator-sim.py
A python client to simulate device pushes into GeoLocator service
#!//usr/local/bin/python
# Author: tckb <[email protected]>
# A python client to simulate device pushes into GeoLocator service
# Usage:
# ./GeoLocator-sim.py --show (-s) [devices/clusters]: shows devices or clusters available in server
# ./GeoLocator-sim.py --reset (-r) : resets the simulation devices
# ./GeoLocator-sim.py --addDevice : registers new device
# ./GeoLocator-sim.py --start (-S) : starts simulation
# ./GeoLocator-sim.py --help (-h) : prints this message
@illucent
illucent / sauce-connect.sh
Created February 1, 2016 11:11 — forked from sarahhodne/sauce-connect.sh
Run Sauce Connect on Travis CI
#!/bin/bash
if [ -z "${SAUCE_USERNAME}" ] || [ -z "${SAUCE_ACCESS_KEY}" ]; then
echo "This script can't run without your Sauce credentials"
echo "Please set SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables"
echo "export SAUCE_USERNAME=ur-username"
echo "export SAUCE_ACCESS_KEY=ur-access-key"
exit 1
fi
SAUCE_TMP_DIR="$(mktemp -d -t sc.XXXX)"