This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git fetch upstream | |
## Remove local branches | |
git remote prune upstream | |
## Clean all gone local branches | |
git fetch -p | |
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
# | |
# Creates an UTF-8 table, or unicode 256. | |
# Tests if the table can validate each UTF-8 char. | |
# | |
# Resources: | |
# https://unicode-table.com/en/#latin-1-supplement | |
# http://www.umich.edu/~umfandsf/other/ebooks/alice30.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a_weights = [400, 200, 100] | |
xweights = [100, 200, 300, 500, 100, 200, 600, 100, 100] | |
W = 500 | |
def one_zero (weights): | |
d = 0 # Current disk position | |
c = 0 # number of files in the current disk | |
disks = [] | |
n = len(weights) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
# Resources: | |
# https://unicode-table.com/en/#latin-1-supplement | |
# http://www.umich.edu/~umfandsf/other/ebooks/alice30.txt | |
control_chars = [ unichr(i) for i in xrange(0, 32) ] | |
basic_latin = [ unichr(i) for i in xrange(32, 128) ] | |
latin_1_supplement = [ unichr(i) for i in xrange(128, 256) ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
fix_sub_delay.py: | |
Add or Remove delay to some SubRip file format (.srt). | |
@author [email protected] | |
""" | |
import sys | |
import os | |
import re | |
from datetime import datetime, timedelta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require('underscore') | |
function filterIndexes(collection, selector) { | |
var results = [], | |
predicate = _.matcher(selector); | |
// Works just like _.filter, but returns the indexes instead | |
_.each(collection, function (value, index, list) { | |
if (predicate(value, index, list)) { | |
results.push(index); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The task will be re-runed after delay seconds | |
// if retry() is called by the caller | |
persistentTask = function (delay, maxRetries, task) { | |
function retry () { | |
if (maxRetries > 0) { | |
maxRetries = maxRetries - 1; | |
setTimeout(function () { | |
task(retry); | |
}, delay); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Router.route('/sniff', function() { | |
var response = this.response; | |
response.writeHead(200, { | |
'Content-Type' : 'text/plain', | |
'X-Content-Type-Options' : 'nosniff' // comment me to redirect the browser | |
}); | |
response.end('<meta http-equiv="refresh" content="0; url=http://example.com/" />'); | |
}, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
var sinon = require('sinon'); | |
var keys = ['closest', 'addClass', 'children', 'parent', 'find', 'html', | |
'remove', 'text', 'ready', 'unveil', 'removeAttr', 'removeClass', 'scroll', | |
'val', 'height', 'css', 'delay', 'queue', 'dequeue', 'attr']; | |
function JQueryStub (args) { | |
var self = this; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const Promise = require('bluebird'); | |
const fs = require('fs'); | |
const deasync = require('deasync'); | |
function readFile(f) { | |
return new Promise(function (resolve, reject) { | |
let file = fs.readFileSync(f); | |
resolve(file); |