Go to the egghead website, i.e. Building a React.js App
run
$.each($('h4 a'), function(index, video){
console.log(video.href);
});
<? | |
///////////////////// | |
// slack2html | |
// by @levelsio | |
///////////////////// | |
// | |
///////////////////// | |
// WHAT DOES THIS DO? | |
///////////////////// | |
// |
Go to the egghead website, i.e. Building a React.js App
run
$.each($('h4 a'), function(index, video){
console.log(video.href);
});
/.bundle | |
/vendor/bundle | |
/.envrc |
#!/usr/bin/env bash | |
# -r 60: 60 FPS | |
# -y: rewrite output file | |
# -start_number 11555: first frame number | |
# -i 'G%07d.JPG': file format | |
# -vf "crop=h=2250": video filter to crop input frame height from 3000 to 2250 (which will be eventually downscaled to 720) | |
# -c:v libx264: video codec x264 | |
# -crf 20: x264 encoding quality (less = better) | |
# -s 1280x720: output size |
⇐ back to the gist-blog at jrw.fi
Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl
. Hold onto your hats, there's some Bucket Policy acrobatics ahead.
There's also a tl;dr at the very end if you just want the delicious copy-pasta.
require 'rubygems' | |
require 'httparty' | |
require 'fileutils' | |
require 'json' | |
USERNAME = ARGV[0] || "patio11" | |
MAX_TO_FETCH = ARGV[1] | |
puts "Username: #{USERNAME} max to fetch: #{MAX_TO_FETCH || "all"}" |
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5] | |
func partition(v: Int[], left: Int, right: Int) -> Int { | |
var i = left | |
for j in (left + 1)..(right + 1) { | |
if v[j] < v[left] { | |
i += 1 | |
(v[i], v[j]) = (v[j], v[i]) | |
} | |
} |
Write a Ruby program that extracts unique four-letter sequences from words in a dictionary file.
sequences.txt
: Contains four-letter sequences that appear in exactly one word.words.txt
: Lists the corresponding word for each sequence, in the same order.require"io/console" | |
_=[[_]*4]*4 | |
t=->{_=_.transpose} | |
r=->{_.map! &:reverse} | |
f=->{_=_.map{|_|_=(_*?\s).gsub(/\b(\d+) +\1\b/){|_|_.to_i*2}.split;_[3]||=p;_}} | |
f[] | |
loop{(0while _[i=rand(4)][j=rand(4)];_[i][j]=[*[?2]*9,?4].sample)if$n!=_*?_ | |
system"clear" | |
_.map{|_|puts"%5s"*4%_} | |
(c=STDIN.getch)[?q]|0 |
if (!document.querySelectorAll) { | |
document.querySelectorAll = function (selectors) { | |
var style = document.createElement('style'), elements = [], element; | |
document.documentElement.firstChild.appendChild(style); | |
document._qsa = []; | |
style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'; | |
window.scrollBy(0, 0); | |
style.parentNode.removeChild(style); |