Skip to content

Instantly share code, notes, and snippets.

View remoharsono's full-sized avatar

Remo Harsono remoharsono

View GitHub Profile
<!DOCTYPE HTML>
<!--
/*
* Remote File Copy Demo 1.0
*
* Copyright 2012, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
<?php
// Twitter Auto-follow Script by Dave Stevens - http://davestevens.co.uk
$user = "";
$pass = "";
$term = "";
$userApiUrl = "http://twitter.com/statuses/friends.json";
//Check if the placeholder is inside an iframe(nested iframe due to some sites auto refresh feature,
//if true redirect to targetUrl.
if(typeof targetUrl === 'undefined' || targetUrl === null){
targetUrl = decodeURIComponent(params["a"]);
}
if (self !== top) {
self.location.href = targetUrl;
}
//Begin:Global Parameters
@remoharsono
remoharsono / extract_emails_from_text.py
Created November 2, 2015 10:11 — forked from dideler/example.md
A python script for extracting email addresses from text files. You can pass it multiple files. It prints the email addresses to stdout, one address per line. For ease of use, remove the .py extension and place it in your $PATH (e.g. /usr/local/bin/) to run it like a built-in command.
#!/usr/bin/env python
#
# Extracts email addresses from one or more plain text files.
#
# Notes:
# - Does not save to file (pipe the output to a file if you want it saved).
# - Does not check for duplicates (which can easily be done in the terminal).
#
# (c) 2013 Dennis Ideler <ideler.dennis@gmail.com>
@remoharsono
remoharsono / get_credentials.py
Created December 10, 2015 02:34 — forked from aruseni/get_credentials.py
Requirements: BeautifulSoup. progressbar
import sys
import httplib2
import urllib
import hashlib
import re
import itertools
from BeautifulSoup import BeautifulSoup
import progressbar
@remoharsono
remoharsono / pyside_dynamic.py
Created December 10, 2015 13:39 — forked from cpbotha/pyside_dynamic.py
pyside_dynamic.py with minor improvements - also see http://stackoverflow.com/a/14894550/532513
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Sebastian Wiesner <lunaryorn@gmail.com>
# Modifications by Charl Botha <cpbotha@vxlabs.com>
# * customWidgets support (registerCustomWidget() causes segfault in
# pyside 1.1.2 on Ubuntu 12.04 x86_64)
# * workingDirectory support in loadUi
# found this here:
# https://github.com/lunaryorn/snippets/blob/master/qt4/designer/pyside_dynamic.py
@remoharsono
remoharsono / Javascript - Prime Number
Last active December 19, 2015 03:38 — forked from jfmercer/prime_numbers.js
Prime Number Checker in Nodejs
//
// Created by John F. Mercer on Monday, December 5, 2011
// john.f.mercer@gmail.com
//
// tested on node 0.6.4 and express 2.5.1
//
var express = require('express'),
app = express.createServer();
app.use(express.logger());
@remoharsono
remoharsono / gist:95910ed53c1a1e4f8d60
Created January 11, 2016 01:34 — forked from emptyhammond/gist:1603144
Make a PUT request with jQuery.ajax()
$.ajax({
type: 'POST', // Use POST with X-HTTP-Method-Override or a straight PUT if appropriate.
dataType: 'json', // Set datatype - affects Accept header
url: "http://example.com/people/1", // A valid URL
headers: {"X-HTTP-Method-Override": "PUT"}, // X-HTTP-Method-Override set to PUT.
data: '{"name": "Dave"}' // Some data e.g. Valid JSON as a string
});
/* Some clients do not support PUT or it’s difficult to send in a PUT request. For these cases, you could POST the request with a request header of X-HTTP-Method-Override set to PUT. What this tells the server is that the intended request is a PUT. Obviously this relies on the API you are accessing making use of the X-HTTP-Method-Override Header.*/
@remoharsono
remoharsono / shape2mysql
Created May 4, 2016 17:46 — forked from rugbyprof/shape2mysql
Add shapefile to MySQL
ogr2ogr -f MySQL MySQL:DATABASENAME,host=localhost,user=USER,password=PASSWORD SHAPEFILE.shp -nln TABLENAME -update -overwrite -lco engine=MYISAM
@remoharsono
remoharsono / jquery add & remove table rows
Created June 25, 2016 02:55 — forked from abixalmon/jquery add & remove table rows
jQuery function to add and remove table row. Works with a form attached.
<table class="table table-striped table-bordered" id="form_fields_data">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>