Skip to content

Instantly share code, notes, and snippets.

View remoharsono's full-sized avatar

Remo Harsono remoharsono

View GitHub Profile
@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());
<!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 / aes_example.py
Last active June 25, 2016 03:01
Python AES two-way encryption/decryption example
from Crypto.Cipher import AES
import base64
import os
# the block size for the cipher object; must be 16, 24, or 32 for AES
BLOCK_SIZE = 32
# the character used for padding--with a block cipher such as AES, the value
# you encrypt must be a multiple of BLOCK_SIZE in length. This character is
# used to ensure that your value is always a multiple of BLOCK_SIZE
@remoharsono
remoharsono / serialize_deserialize_json.vb
Last active June 25, 2016 03:00
VB.NET Utility Class to Serialize Deserialize Json String
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Runtime.Serialization.Json
Imports System.IO
Imports System.Text
Imports System.Text.RegularExpressions
''' <summary>
''' JSON Serialization and Deserialization Assistant ClassS
@remoharsono
remoharsono / unserialize_session.py
Last active June 25, 2016 02:59 — forked from scragg0x/gist:3894835
Unserialize PHP Session in Python
def unserialize_session(val):
if not val:
return
session = {}
groups = re.split("([a-zA-Z0-9_]+)\|", val)
if len(groups) > 2:
groups = groups[1:]
groups = map(None, *([iter(groups)] * 2))
for i in range(len(groups)):
@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