Skip to content

Instantly share code, notes, and snippets.

@ecelis
ecelis / default.conf
Created Aug 30, 2016 — forked from alanbriolat/default.conf
nginx userdir + PHP-FPM
View default.conf
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
Android Linux udev rules
View 51-android.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 — forked from sdague/imaway
dbus xchat integration
View imaway
#!/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 Oct 18, 2015 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys
View gpg-import-and-export-instructions.md

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...
View keybase.md

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 Aug 29, 2015
Java Version Checker
View ClassVersionChecker.java
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 Jun 10, 2015
Thompnson's shell IRC bot
View .osirz.conf
NICK osirz
USER osirz +iw osirz telnet
JOIN #pruebamibot
@ecelis
ecelis / RepositoryServer.java
Created Mar 26, 2015
Java FileLock & IPC server example
View RepositoryServer.java
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 Aug 29, 2015
Custom wordpress registration form
View myreg.php
<?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'])) {
View generate-pushid.js
/**
* 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).
*/