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 FromRight(str1, str2) { | |
var longest, tmpshortest, shortest; | |
if(str1.length != str2.length) { | |
if(str1.length > str2.length) { | |
longest = str1; | |
tmpshortest = str2; | |
} else { | |
longest = str2; | |
tmpshortest = str1; | |
} |
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
//Run an array of values in series. | |
//Non-functions are wrapped in Promise.resolve(). | |
//Functions are passed to the Promise constructor. (eg new Promise(myFunction);) | |
//Series order starts from 0. | |
Promise.series = function PromiseSeries(promises) { | |
function assignTo(o, k) { | |
return function(v) { | |
o[k] = v; | |
return v; | |
}; |
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.prototype.bindMap = function(context) { | |
function nullfilter(v) { return v != null; } | |
function isnotfalse(v) { return v !== false; } | |
function getUndefinedIndex(v, i, a) { return typeof a[i] == 'undefined' ? i : false; } | |
var self = this; | |
var args = Array.prototype.slice.call(arguments, 1); | |
var unargs = args.map(getUndefinedIndex).filter(isnotfalse); | |
return function() { |
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 | |
tuser="TWITTERUSERNAME"; | |
searchurl="https://twitter.com/search?f=tweets&vertical=default&q=from%3A$tuser&src=typd" | |
curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36" -s "$searchurl" | pup "a[href*=$tuser/status] attr{href}" 2>/dev/null | xargs -I {} archive.to "https://twitter.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
$video = "path/to/source/file.mp4"; | |
$video_extension = "mp4"; ##This must match what the source file has. eg. if it's flv, use that. | |
$output_directory = "output/directory/video"; ##destination folder for 2 hour chunks | |
$ffmpegEXE = "path/to/ffmpeg.exe"; | |
for($i = 0; $i -lt 13; $i++) { | |
& $ffmpegEXE -i $video -ss ("{0}:00:00" -f (($i)*2)) -t "2:0:0" -c copy ("{0}_{1}.{2}" -f $output_directory, ($i+1), $video_extension); | |
} |
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 | |
turl="$1"; #`php -r "echo urlencode(\$argv[1]);" "$1"`; | |
enurl=`php -r "echo urlencode('$turl');"`; | |
#php -r "echo urlencode(\$argv[1]);" "$1" ; # $turl; | |
aurl="https://archive.is/?run=1&url=$enurl"; |
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 comp(a, b, n) { | |
let p1,p2,ret; | |
ret = 0; | |
ret += a < b; | |
ret -= a > b; | |
ret = convert(ret ? ret : 0, n); | |
return ret | |
p1 = ((a<b)/2); |
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 bodyParser from 'body-parser'; | |
import express from 'express' | |
import * as _ from 'lodash'; | |
import * as IPFS from 'ipfs-client'; | |
import Queue from 'promise-queue'; | |
import xmlp from 'fast-xml-parser'; | |
import { readFileSync } from 'fs'; | |
const app = express() | |
const port = 3000 |
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
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
OlderNewer