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
// @flow | |
export const serialResolve = (functionsReturningPromises: Array<() => Promise<any>>, parallelTasks: number) => new Promise((resolve, reject) => { | |
let tasksStarted = 0; | |
// Create empty results array | |
const results = Array.from(functionsReturningPromises, () => null); | |
const totalFunctions = functionsReturningPromises.length; | |
// When a promise completes, set the correct results index and start any additional tasks | |
let completedPromises = 0; |
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
Privacy Policy of Ultimate Miner | |
In order to receive information about your Personal Data, the purposes and the parties the Data is shared with, contact the Owner. | |
Data Controller and Owner | |
Types of Data collected | |
The owner does not provide a list of Personal Data types collected. | |
Other Personal Data collected may be described in other sections of this privacy policy or by dedicated explanation text contextually with the Data collection. | |
The Personal Data may be freely provided by the User, or collected automatically when using this Application. | |
Any use of Cookies - or of other tracking tools - by this Application or by the owners of third party services used by this Application, unless stated otherwise, serves to identify Users and remember their preferences, for the sole purpose of providing the service required by the User. | |
Failure to provide certain Personal Data may make it impossible for this Application to provide its services. | |
Users are responsible for any Personal Data of third parties obtained, publ |
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 | |
ifconfig | grep "br-" | sed s/:.*// | xargs -I interface ip link set interface down | |
brctl show | grep "br-" | sed s/\s*8000.*// | xargs -I interface brctl delbr interface |
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
async function add(x:number,y:number):Promise<number>{ | |
return x + y | |
} | |
const a = [1,2,3,4,5] | |
function PARALLEL(){ | |
return Promise.all(a.map((v) => add(v,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
#!/bin/bash | |
git checkout -b $1 | |
git push origin $1 | |
hub pull-request | |
read -p "back to master? <y/N> " prompt | |
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]] | |
then | |
git fetch | |
git checkout origin/master |
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
/* | |
Hot Session Middleware | |
A hot session only exists on the server, we track it and expire it. It is cookie-less, | |
however the client needs to keep sending their token. It's basically a cookie without | |
cookies. | |
TODO This is not distributed, it can only be run on a single server, and a server restart | |
will cause all sessions to disappear. |
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 | |
import os.path as path,os,json, time | |
# Get path to temporary files for scripts directory | |
tmpDir = path.join(path.dirname(path.realpath(__file__)), "tmp") | |
class File: | |
def __init__(self, name, path, creationTime): | |
self.name = name | |
self.path = path |
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
import shutil | |
import os | |
from os.path import join | |
import time | |
import sys | |
""" | |
USAGE | |
python filetype_sorter.py <target directory> | |
""" | |
directory = sys.argv[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
# This script is for automatically labeling all the images in a directory with their | |
# names (for lab reports, technical documents etc.). Uses ImageMagick's convert command. | |
# Currently windows specific, but it should be easy to make compatible with linux | |
# This may also be possible as a one-liner with image magick. | |
import os | |
import os.path | |
try: os.system('rmdir labeled /s /q') | |
except: pass |
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
import subprocess | |
import json | |
import sys | |
workspaces = json.loads(subprocess.check_output("i3-msg -t get_workspaces", shell=True)); | |
activeWorkspaceNum = None | |
activeWorkspaceName = None | |
for workspace in workspaces: | |
if workspace["visible"]: | |
activeWorkspaceNum = workspace['num'] |