Skip to content

Instantly share code, notes, and snippets.

@aragaer
aragaer / _service.md
Last active August 29, 2015 13:56 — forked from naholyr/_service.md

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@aragaer
aragaer / .gitignore
Last active August 29, 2015 14:12
Buffer class
*.o
*.swp
@aragaer
aragaer / gist:7c95722f81da04768d48
Created January 26, 2015 04:52
Getting names of chrome applications
# assuming current directory is Extensions
find -name manifest.json -exec grep '"name"' {} + | awk -vFS='/|"' '!/__/{print $2, $7}'
find -name manifest.json -exec grep '"name"' {} + | awk -vFS='/|"' '/__/{print $2, $7}' | sed 's/__MSG_//; s/__//' | sort -u -k1 | while read app var; do echo -n $app; sed -n "/$var/I, /}/ p" $app/*/_locales/en*/messages.json | grep -m1 message | cut -d ':' -f2; done
@aragaer
aragaer / server.py
Last active August 29, 2015 14:24
simple python low-level http server
#!/usr/bin/env python3
from http.server import BaseHTTPRequestHandler, HTTPServer
class MyHandler(BaseHTTPRequestHandler):
_data_to_send = None
def _send_all(self):
@aragaer
aragaer / sptest.cpp
Created May 7, 2010 14:35
smart pointers
#include "sptest.h"
#include <stdio.h>
class test {
public:
test() {
printf("Test constructor\n");
field = new char[20];
is_deleted = false;
}
@aragaer
aragaer / eve-central.js
Created May 11, 2010 13:58
eve-central component
const Cc = Components.classes;
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var gOS;
const Query = {
getPrice: "select price from simple_prices where typeID=:tid " +
"and date('now') < date(exp_date);",
setPrice: "replace into simple_prices values(:tid, :price, " +
@aragaer
aragaer / gist:454839
Created June 27, 2010 11:36
Simple pseudo-terminal app
#include <stdio.h>
#include <stdlib.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
char *path = "/home/aragaer/pts";
char linkname[80] = "";
@aragaer
aragaer / gist:473063
Created July 12, 2010 21:11
Python and EVE
#!/usr/bin/python
import urllib
import urllib2
from xml.dom.minidom import parse
user_id = 2373898
api_key = "<snip>"
char_id = 1580122797
uri_base = 'http://api.eve-online.com'
# set this to your eve path
EVEROOT = "/home/aragaer/.wine/drive_c/Program Files/CCP/EVE"
# start ooocalc like this:
# oocalc -accept="socket,host=localhost,port=2002;urp;"
# then run this script and type a character id anywhere
import uno
import android
import time
from math import sqrt
droid = android.Android()
droid.wakeLockAcquirePartial()
def main():
while True:
total = 0