Skip to content

Instantly share code, notes, and snippets.

@thinkjson
thinkjson / loggly.js
Created February 21, 2014 02:12
Loggly example
var http = require('http');
var options = {
host: 'logs.loggly.com',
port: 80,
path: '/inputs/{input_id}',
method: 'POST'
};
exports.write = function(data) {
var req = http.request(options, function(res) {});
req.on('error', function(e) {
@thinkjson
thinkjson / bookmarklet.js
Last active August 29, 2015 13:56
CORS Instapaper POC for pages with Content Protection Policy
javascript:$.post('http://server.thinkjson.com/echo.php?url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title));
@thinkjson
thinkjson / voice.py
Created June 3, 2014 12:41
say REPL
import cmd
import os
import subprocess
import shlex
from pipes import quote
devnull = open(os.devnull, 'w')
class Voice(cmd.Cmd):
"""Simple command processor example."""
@thinkjson
thinkjson / new_host_DNS.py
Last active August 29, 2015 14:17
Check to see when DNS for a new host has propagated
import requests
import sys
import time
import subprocess
if len(sys.argv) != 2:
print 'Usage: new_host_DNS.py [url]'
sys.exit(0)
NX = True
@thinkjson
thinkjson / REPL
Created April 11, 2015 00:42
Intro to Programming Lesson 2
$ python
Python 2.7.8 (default, Apr 8 2015, 14:55:10)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from speech import say
>>> say('this is a test')
>>> say('this is a test')
>>> say('Hello Ellisheva!')
>>> say('hello daddy')
>>> "na"*3
@thinkjson
thinkjson / gist:ec5e23a3e39c9a26fd57
Created April 13, 2015 12:02
Intro to Programming Lesson 2
Python 2.7.8 (default, Apr 8 2015, 14:55:10)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ["one","two","three"]
['one', 'two', 'three']
>>> ["one","two","three"][:2]
['one', 'two']
>>> ["one","two","three"][:-1]
['one', 'two']
>>> ["one","two","three"][-1]
@thinkjson
thinkjson / scrollback
Created May 2, 2015 18:42
yet another programming lesson
>>> from speech import say
>>> words = []
>>> words
[]
>>> words.append("hello")
>>> words
['hello']
>>> words.append("elisheva")
>>> say(words)
>>> words.reverse()
@thinkjson
thinkjson / 2017_07_06_lesson.py
Created July 7, 2017 00:37
Programming lesson: imports, function definition, keyboard shortcuts, function calls, for loops, iteration and conditionals
# Imports
import subprocess
# Function definition
def say(thing):
subprocess.call('say %s' % thing, shell=True)
# Keyboard shortcuts
# Cmd+S save
# Cmd+C copy
@thinkjson
thinkjson / proposal.md
Last active October 12, 2017 00:24
This is a proposal for identifying and retaliating against abusers on the Twitter platform. Using a combination of sentiment analysis and mechanical turk, the system can flag abusive tweets and report repeat offenders in real time. This is a proposal for the abuse system that should have been built into Twitter. Comments welcome.

Abusive tweet storms and DDoS

Abusive tweet storms brought on by a Twitter user with a significant amount of followers using their influence to intimidate or verbally abuse another Twitter user bears some striking similarities to a DDoS attack. If you frame the problem in terms of a DDoS attack, then many mitigation techniques used against DDoS attacks can also be used against these Twitter attacks.

Identification of abusive tweets

By opting in, users can submit their replies for analysis by the system. Using sentiment analysis, abusive tweets can be identified programmatically, and confirmed using a mechanical turk like system. In order to broaden the scope of the analysis, the abusive user's other replies are analyzed and catalogued, being