Skip to content

Instantly share code, notes, and snippets.

guy-a

Block or report user

Report or block guy-a

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@guy-a
guy-a / leacher.py
Created May 3, 2015
A python script for leeching a folder on an FTP. run$ python supervisor.py leacher.py
View leacher.py
import os
import logging
import ftplib
from ftplib import FTP
class Leacher:
def __init__(self, host, account, passwd, ftp_folder='', local_folder_path='', delete_files='False', file_match=''):
logging.basicConfig(filename='leacher.log', format='%(asctime)s - %(levelname)s: %(message)s', level=logging.DEBUG)
@guy-a
guy-a / toFixed.js
Last active May 2, 2018
To Fix Javascript toFixed
View toFixed.js
/* https://blog.guya.net/2012/08/18/to-fix-javascript-tofixed/
https://stackoverflow.com/a/11818658/275333 */
function toFixed(num, fixed) {
var re = new RegExp('^-?\\d+(?:\.\\d{0,' + (fixed || -1) + '})?');
return num.toString().match(re)[0];
}
@guy-a
guy-a / Chrome_CORS.bat
Last active Mar 1, 2017
Windows batch to open a separate session of chrome where the same-origin-policy is disabled. Great for testing.
View Chrome_CORS.bat
start "" "c:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="c:/_chrome_dev" --disable-web-security
@guy-a
guy-a / detect-private-browsing.js
Created Mar 22, 2016 — forked from cou929/detect-private-browsing.js
Detect private browsing mode (InPrivate Browsing or Incognito).
View detect-private-browsing.js
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@guy-a
guy-a / Canary_CORS.bat
Last active Jan 14, 2016
Windows batch to open a separate session of CANARY where the same-origin-policy is disabled. Great for testing.
View Canary_CORS.bat
start "" "c:\Users\%USERNAME%\AppData\Local\Google\Chrome SxS\Application\chrome.exe" --user-data-dir="c:/_canary_dev" --disable-web-security
You can’t perform that action at this time.