Skip to content

Instantly share code, notes, and snippets.

View sawantuday's full-sized avatar

Uday R Sawant sawantuday

  • J.P. Morgan Chase & Co
  • India
View GitHub Profile

Git Cheat Sheet

Commands

Getting Started

git init

or

@morganrallen
morganrallen / _README.md
Last active January 15, 2023 19:41
Janky Browser

JankyBrowser

The only cross-platform browser that fits in a Gist!

One line install. Works on Linux, MacOSX and Windows.

Local Install

$> npm install http://gist.github.com/morganrallen/f07f59802884bcdcad4a/download
@Kukunin
Kukunin / onresourceloaded.js
Created June 30, 2014 19:44
PhantomJS module to implement robust onLoadFinished callback, supporting redirects, JS resource loading etc
function addAllResourcesLoadedCallback(page, timeout) {
function debug(text) {
if (typeof page.onDebug == "function") {
page.onDebug(text);
}
}
var counter = [], timer;
timeout = timeout || 2000;
@Yomguithereal
Yomguithereal / .gitignore
Last active March 25, 2024 22:52
Hacker News scraper artoo.js bookmarklet
node_modules
build
*.min.js
@deviantony
deviantony / phantomjs
Last active January 4, 2018 17:18 — forked from wbotelhos/phantomjs_intaller.sh
Installer script to setup phantomjs 1.9.7, it will remove any previous setup. Contains also the init script to manage phantomjs as a system service and the default configuration file. Tested on Ubuntu 12.04.
#! /bin/sh
# Init. script for phantomjs, based on Ubuntu 12.04 skeleton.
# Author: Anthony Lapenna <[email protected]>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Phantomjs service"
NAME=phantomjs
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
@archagon
archagon / dom-filter.js
Last active February 4, 2016 06:36
The start of a generic DOM filtering bookmarklet, along with sample code. Useful if a website's filters aren't specific enough. SEL is the selector for the main list item and COND is a filtering function that you can customize.
var PRINT = false;
var LOG = 1;
var SEL = ".pin";
var COND = function($node) {
var ret = true;
ret = checkNum($node, ".pinPrice", ">=", 10);
if (!ret) { return false; }
@mangecoeur
mangecoeur / concurrent.futures-intro.md
Last active July 20, 2024 10:30
Easy parallel python with concurrent.futures

Easy parallel python with concurrent.futures

As of version 3.3, python includes the very promising concurrent.futures module, with elegant context managers for running tasks concurrently. Thanks to the simple and consistent interface you can use both threads and processes with minimal effort.

For most CPU bound tasks - anything that is heavy number crunching - you want your program to use all the CPUs in your PC. The simplest way to get a CPU bound task to run in parallel is to use the ProcessPoolExecutor, which will create enough sub-processes to keep all your CPUs busy.

We use the context manager thusly:

with concurrent.futures.ProcessPoolExecutor() as executor:
@ndhu
ndhu / phantomjsGoogleSearch
Created January 8, 2014 23:02
phantomjs. example on how to search google, collect links of search result and scrape multiple pages of the search result
/**
* Created by andy hulstkamp
*/
var webpage = require("webpage"),
fs = require("fs");
var debug = false,
pageIndex = 0,
allLinks = [],
@smoser
smoser / ubuntu-cloud-virtualbox.sh
Last active July 5, 2024 09:33
example of using Ubuntu cloud images with virtualbox
## Install necessary packages
$ sudo apt-get install virtualbox-ose qemu-utils genisoimage cloud-utils
## get kvm unloaded so virtualbox can load
$ sudo modprobe -r kvm_amd kvm_intel
$ sudo service virtualbox stop
$ sudo service virtualbox start
## URL to most recent cloud image of 12.04
$ img_url="http://cloud-images.ubuntu.com/server/releases/12.04/release"
@nevkontakte
nevkontakte / ubuntu-cloud-bootable.sh
Created June 26, 2013 10:03
Make Ubuntu Cloud images bootable in virtualbox. Pre-requirements: qemu-img (package qemu-utils in Ubuntu repo), extlinux Tested under Ubuntu 13.04, might work on other linux distros. Get ubuntu image: http://cloud-images.ubuntu.com/precise/current/*.img
#!/bin/bash
##
## Usage: sudo ubuntu-cloud-bootable.sh precise-server-cloudimg-amd64-disk1.img
##
set -e
mount_point="$(mktemp -d)"
raw="$(mktemp)"
echo ">>> Converting to raw: $raw ..."