Skip to content

Instantly share code, notes, and snippets.

@kontinuity
kontinuity / mlphone.js
Created September 4, 2015 12:10
Standalone version of MetroLeads DNI javascript
/*
qwest, ajax library with promises and XHR2 support
Version : 0.3.6
Author : Aurélien Delogu (dev@dreamysource.fr)
Homepage : https://github.com/pyrsmk/qwest
License : MIT
*/
qwest=function(){

Keybase proof

I hereby claim:

  • I am kontinuity on github.
  • I am arif (https://keybase.io/arif) on keybase.
  • I have a public key whose fingerprint is 789E 73A4 BA81 0543 CF8F 1157 5E33 300E 7634 AF14

To claim this, I am signing this object:

#!/usr/bin/python
from fabric.api import local, env, puts, run, require, cd, put, prefix
from fabric.decorators import parallel
def yummy():
host_list = [
(['localhost'], '/Users/username/private_key')
]
env.upg_command = 'sudo apt-get install bash'
@kontinuity
kontinuity / frequency_test.c
Created September 17, 2012 10:33
Kernel timing test
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#define USECREQ 250
#define LOOPS 1000
@kontinuity
kontinuity / cronjob.sh
Created August 22, 2012 18:52 — forked from memonic/cronjob.sh
Script to transform Amazon RDS slow log table into the MySQL slow query log format
#!/bin/bash
(/usr/local/bin/db2log | \
mk-query-digest --fingerprints \
--filter '$event->{user} !~ m/^(bi|memonic)$/') 2>&1 | \
mail -s "MySQL slow logs" root
# Rotate slow logs. Will move them into the backup table slow_log_backup. If
# that table exists it's overwritten with the primary slow log.
# So with this strategy we can still access yesterday's slow log by querying
# slow_log_backup.
package core;
import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.io.IOException;
public class BootStrapper {
* 0 * * * * python -c "import re, requests; from BeautifulSoup import BeautifulSoup; print re.findall(r'Dear Customer.*current Bill Cycle \d+', ' '.join(''.join(BeautifulSoup(requests.get('http://122.160.230.125:8080/gbod/gb_on_demand.do').content).findAll(text=True)).split()))[0]" | mailx -v -s "Airtel DSL usage status on `date`" you@yourdomain.com > /var/log/airtel.log 2>&1
insert query update delete getmore command flushes mapped vsize res faults locked % idx miss % qr|qw ar|aw netIn netOut conn
3 14 8 0 3 10 0 12.4g 26g 4.43g 0 39.2 0 1|0 1|1 28k 166k 10
2 12 8 0 3 17 0 12.4g 26g 4.43g 3 104 0 2|0 2|1 20k 106k 11
1 6 5 0 2 9 0 12.4g 26g 4.43g 0 101 0 3|0 4|1 10k 187k 11
3 3 6 0 0 11 0 12.4g 26g 4.43g 0 40.9 0 1|3 1|2 220k 298k 11
1 7 5 0 2 49 0 12.4g 26g 4.43g 0 146 0 2|0 2|1 13k 79k 11
7 250 37 0 1 8 0 12.4g 26g 4.43g 0 43.9 0 0|0 0|1 133k 11m 11
2 13 220 0 1 19 0 12.4g
{
"username": "jack-roach",
"last_updated_on": 124,
"index": [{
"a": "arif@fb",
"b": "arif@fb",
"c": "id_arif"
}, {
"a": "arif@gt",
"b": "arif@gt",
@kontinuity
kontinuity / gist:2626580
Created May 7, 2012 07:58
Mongo pull discrepancy
> var x = {x: 0, y: [ {a:1,b:100}, {a:2,b:101} ]}
> db.tester.drop()
true
> db.tester.insert(x)
> db.tester.findOne()
{
"_id" : ObjectId("4fa7803455bdd0772d514ffc"),
"x" : 0,
"y" : [
{