Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Angel Investor & Advisor

Ron Gross ripper234

💭
Angel Investor & Advisor
View GitHub Profile
@ripper234
ripper234 / MobileUADetector
Created May 31, 2012
Detect mobile user agent in Java
View MobileUADetector
import java.util.regex.Pattern;
/**
* Detect mobile User Agent
*
* Adpated from http://detectmobilebrowsers.com/download/cs on 31/05/2012
*/
public class MobileUADetector {
private final static Pattern mobile_b = Pattern.compile("android.+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
@ripper234
ripper234 / Protocol.txt
Created Jan 17, 2012
How to decode messages stored in the Bitcoin blockchain with btcmsg
View Protocol.txt
BTCmsg Protocol v1 (2011-09-18)
===============================
Each message is represented by multiple payment which is calculated by
the following algorithm:
1. Two first chars for message type ('01' for md5, '02' for ascii).
2. Then the message in hex (python binascii.hexlify).
3. Split the long string to groups of 4 hex digits.
4. Each group of 4 hex (e.g. 2 ascii letters from the message) is
represented by a payment in satoshi (maximum 0xffff=65535).
@ripper234
ripper234 / decrypt.js
Created Feb 22, 2013
Password checker for encrypted JSON from blockchain.info (My Wallet) bitcoin wallet
View decrypt.js
// To run this:
// 1. Install node.js
// 2. Fill in encrypted & password below
// 3. node decrypt.js
var encrypted = ''; // copy paste encrypted json here
var password = ''; // your password goes here
(typeof Crypto == "undefined" || !Crypto.util) && function () {
var a = Crypto = {}, b = a.util = {
View mousespeed-sparkline.js
function drawMouseSpeedDemo() {
var mrefreshinterval = 500; // update display every 500ms
var lastmousex=-1;
var lastmousey=-1;
var lastmousetime;
var mousetravel = 0;
var mpoints = [];
var mpoints_max = 30;
$('html').mousemove(function(e) {
var mousex = e.pageX;
View gist:965603
// original (broken) version is here: http://ivan-ghandhi.livejournal.com/942493.html
// My fix: don't treat arguments as if it were an array
// (Use Array.prototype.slice.call() to convert it)
function stacktrace() {
function st2(f) {
return !f ? [] :
st2(f.caller).concat([f.toString().split('(')[0].substring(9) + '(' + Array.prototype.slice.call(f.arguments).join(',') + ')']);
}
return st2(arguments.callee.caller);
@ripper234
ripper234 / placepaintbot4.js
Last active Apr 2, 2017 — forked from mbarkhau/placepaintbot4.js
placepaintbot4.js
View placepaintbot4.js
// ==UserScript==
// @name PlacePaintBot
// @namespace http://tampermonkey.net/
// @version 0.4
// @description Domination of Place!
// @author mbarkhau
// @match https://www.reddit.com/place?webview=true
// @grant none
// ==/UserScript==
View Lifeboat Wikipedia Export
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.8/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.8/ http://www.mediawiki.org/xml/export-0.8.xsd" version="0.8" xml:lang="en">
<siteinfo>
<sitename>Wikipedia</sitename>
<base>http://en.wikipedia.org/wiki/Main_Page</base>
<generator>MediaWiki 1.22wmf2</generator>
<case>first-letter</case>
<namespaces>
<namespace key="-2" case="first-letter">Media</namespace>
<namespace key="-1" case="first-letter">Special</namespace>
@ripper234
ripper234 / gist:5478428
Created Apr 28, 2013
Export of the Wikipedia article about Lifeboat Foundation, preserved in case it is deleted.
View gist:5478428
<!-- Please do not remove or change this AfD message until the issue is settled -->
{{AfDM|page=Lifeboat Foundation (2nd nomination)|year=2013|month=April|day=26|substed=yes|origtag=afdx}}
<!-- End of AfD message, feel free to edit beyond this point -->{{notability|date=April 2013}}
{{refimprove|date=April 2013}}
{{Infobox organization
| name = Lifeboat Foundation
| former name =
| image =
| image_border =
@ripper234
ripper234 / MonitorLoad.scala
Created Feb 25, 2013
Another attempt at a Play Framework 2.1 scheduled task example
View MonitorLoad.scala
import akka.actor.{Props, Actor}
import concurrent.ExecutionContext
import play.api.Logger
import play.libs.Akka
import scala.concurrent.duration._
import ExecutionContext.Implicits.global
case object Tick