Skip to content

Instantly share code, notes, and snippets.

var fs = require('fs')
var Q = require('q')
var fs_stat = Q.denodeify(fs.stat)
var fs_readdir = Q.denodeify(fs.readdir)
var files = [
'./fixtures/file1',
'./fixtures/file2',
'./fixtures/file3',
'./fixtures/file4'
@rixtox
rixtox / README.md
Last active August 29, 2015 13:57
JavaScript Asynchronous Deep Mapping With Promise

deepMap(object, iterator [, routePrefix])

Iterate and map recursively into an object. Return a promise object with a standard then interface created by Q. The depth and data types can be controlled by the iterator.

When encounters an array object, the returned value is an object use the indices of the array as its keys in String.

Note, that module q is required to handle the async quenue and create promises.

Arguments

bigf = (n) ->
for i in [2..Math.sqrt n]
return n / i unless n % i
n
LPF = (n) ->
bf = bigf n
return bf if bf == n
LPF bf
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
var result = ~ function(str) {
// Define a DSL
var r = function(target, replace) {
str = str.replace(new RegExp(target, 'gi'), replace || target);
};
// Use the DSL
r('JavaScript');
r('gogle', 'Google');
var alias;
S.cfga({
defaultToCurrentScreen: true,
nudgePercentOf: 'screenSize',
resizePercentOf: 'screenSize'
});
alias = {
full: S.op('move', {
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\shell\runas]
[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open command window here as Administrator"
"HasLUAShield"=""
[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""
@rixtox
rixtox / 50-huawei-e1750.rules
Last active August 29, 2015 14:14
/etc/udev/rules.d/50-huawei-e1750.rules
SUBSYSTEM=="usb",
ATTR{idVendor}=="12d1",
ATTR{idProduct}=="1446",
RUN+="usb_modeswitch -v 12d1 -p 1446 -W -J"
RUN+="asterisk -x 'dongle cmd dongle0 AT^SYSCFG=13,1,3FFFFFFF,1,2'"
@rixtox
rixtox / .tmux.conf
Last active August 29, 2015 14:17 — forked from shouya/.server-setup
set -g default-terminal "xterm-256color"
set-option -g prefix M-n
set-window-option -g mode-keys emacs
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
@rixtox
rixtox / Export Timing Points to OSU.py
Last active October 19, 2019 14:23
Export REAPER Tempo Markers to osu! Timing Points
import sys, os, configparser, codecs, re
sys.argv=["Main"]
import tkinter as tk
from tkinter.filedialog import asksaveasfilename
root = tk.Tk()
root.withdraw()
proj = RPR_EnumProjects(-1, "", 512)[0]