Skip to content

Instantly share code, notes, and snippets.

View ali-order-export-csv.js
// ==UserScript==
// @name Aliexpress - Orders to CSV
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://trade.aliexpress.com/orderList.htm*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_setClipboard
View secure.md
yum install epel-release
yum install fail2ban

# /etc/fail2ban/jail.local
[DEFAULT]
ignoreip = 127.0.0.1
bantime  = 3600
findtime  = 600
maxretry = 3
@madaboutcode
madaboutcode / bsedownload.js
Last active Oct 7, 2015
casperjs - bsedownload
View bsedownload.js
var casper = require("casper").create({
pageSettings: {
webSecurityEnabled: false
}
});
var x = require('casper').selectXPath;
var fs = require('fs');
function printArgs() {
var i, ilen;
@madaboutcode
madaboutcode / index.html
Last active Aug 29, 2015
Windows custom protocol handlers
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.button {
background: #65a9d7;
display: inline-block;
padding: 10px 20px;
text-decoration: none;
width: auto;
color: white;
View addflow.xml
<flow name="addFlow">
<http:inbound-endpoint keep-alive="true" exchange-pattern="request-response" host="localhost" port="${http.port}" path="add"/>
<transformer ref="httpToMapTransformer"/>
<message-properties-transformer scope="invocation">
<add-message-property key="contextName" value="#[map-payload:campaignName]" />
</message-properties-transformer>
<dynamicflows:add contextName="#[variable:contextName]">
@madaboutcode
madaboutcode / amqptest.py
Last active Sep 4, 2015
EMSP - Python - AMQP Listener
View amqptest.py
#!/usr/bin/env python
import pika
import sys
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.exchange_declare(exchange='emsp',
type='topic')
@madaboutcode
madaboutcode / encode.bat
Created Aug 31, 2014
ffmpeg batch encode
View encode.bat
@echo off
if %1.==Sub. goto %2
echo Encoding files in %1
set dir=%1
if exist %dir%\encoded\NUL goto processfiles
@madaboutcode
madaboutcode / callhistory.sql
Created Jun 14, 2014
Call history, ios, iphone, query
View callhistory.sql
select datetime(date, 'unixepoch') as dd,address,duration/60,id,
case (flags>>15)&1 when 1 then '1' else '0' end || case (flags>>14)&1 when 1 then '1' else '0' end || case (flags>>13)&1 when 1 then '1' else '0' end || case (flags>>12)&1 when 1 then '1' else '0' end || case (flags>>11)&1 when 1 then '1' else '0' end || case (flags>>10)&1 when 1 then '1' else '0' end || case (flags>>9)&1 when 1 then '1' else '0' end || case (flags>>8)&1 when 1 then '1' else '0' end || case (flags>>7)&1 when 1 then '1' else '0' end || case (flags>>6)&1 when 1 then '1' else '0' end || case (flags>>5)&1 when 1 then '1' else '0' end || case (flags>>4)&1 when 1 then '1' else '0' end || case (flags>>3)&1 when 1 then '1' else '0' end || case (flags>>2)&1 when 1 then '1' else '0' end || case (flags>>1)&1 when 1 then '1' else '0' end || case (flags>>0)&1 when 1 then '1' else '0' end flagbin
, flags, answered from call where duration > 0 and face_time_data IS NULL order by dd desc;
View fql-reference.json
{
"__ar": 1,
"payload": {
"entries": [{
"uid": "keywordSELECT",
"subtext": "[FQL keyword]",
"text": "SELECT"
}, {
"uid": "keywordFROM",
"subtext": "[FQL keyword]",
@madaboutcode
madaboutcode / django-cheats.md
Last active Aug 29, 2015
django cheats, reference
View django-cheats.md

#Query

# group by, count and sort
Model.objects.values('ingredient','category').annotate(count=Count('ingredient')).order_by('-count')
You can’t perform that action at this time.