Skip to content

Instantly share code, notes, and snippets.

View ecelis's full-sized avatar
🏹
📷 🥊

Ernesto Celis ecelis

🏹
📷 🥊
View GitHub Profile
@ecelis
ecelis / default.conf
Created August 30, 2016 12:59 — forked from alanbriolat/default.conf
nginx userdir + PHP-FPM
server {
listen 80;
server_name localhost;
# ... other default site stuff, document root, etc. ...
location ~ ^/~(?<userdir_user>.+?)(?<userdir_uri>/.*)?$ {
alias /home/$userdir_user/public_html$userdir_uri;
index index.html index.htm index.php;
autoindex on;
@ecelis
ecelis / 51-android.rules
Created May 24, 2016 20:30
Android Linux udev rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
@ecelis
ecelis / imaway
Created May 23, 2016 13:54 — forked from sdague/imaway
dbus xchat integration
#!/usr/bin/python
import dbus
import dbus.glib
import gobject
import subprocess
def lock():
print "Screen saver turned on"
@ecelis
ecelis / gpg-import-and-export-instructions.md
Created October 18, 2015 03:26 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@ecelis
ecelis / keybase.md
Last active September 21, 2015 23:35

Keybase proof

I hereby claim:

  • I am ecelis on github.
  • I am ecelis (https://keybase.io/ecelis) on keybase.
  • I have a public key whose fingerprint is F29C 399A 7B19 FA67 4B9E BDF6 2D55 1002 2615 FA80

To claim this, I am signing this object:

@ecelis
ecelis / ClassVersionChecker.java
Last active August 29, 2015 14:28
Java Version Checker
import java.io.*;
/* Code taken from http://www.rgagnon.com/javadetails/java-0544.html
Usage
> java ClassVersionChecker ClassVersionChecker.class
ClassVersionChecker.class: 49 . 0
*/
public class ClassVersionChecker {
@ecelis
ecelis / .osirz.conf
Created June 10, 2015 12:24
Thompnson's shell IRC bot
NICK osirz
USER osirz +iw osirz telnet
JOIN #pruebamibot
@ecelis
ecelis / RepositoryServer.java
Created March 26, 2015 22:04
Java FileLock & IPC server example
package server.ipc;
import java.io.*;
import java.net.*;
//import server.model.*;
public class RepositoryServer {
ServerSocket serverSocket = null;
int state = 0;
//IProtocolHandler protocolHandler;
@ecelis
ecelis / myreg.php
Last active August 29, 2015 14:16
Custom wordpress registration form
<?php
/*
* Plugin Name: My Registration
* mkdir wp-content/plugins/myreg
*/
// Add new form element
add_action('register_form', 'myreg_register_form');
function myreg_register_form() {
if(!empty($_POST['first_name'])) {
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/