I hereby claim:
- I am knugie on github.
- I am knugie (https://keybase.io/knugie) on keybase.
- I have a public key whose fingerprint is 4F54 2255 6028 FAFB 7458 E545 4276 8876 DFB2 3E2B
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# Using ffmpeg | |
ffmpeg -y -i video.mp4 -vf fps=1,scale=600:-1:flags=lanczos,palettegen palette.png | |
ffmpeg -i video.mp4 -i palette.png -filter_complex "setpts=0.125*PTS,fps=5,scale=600:-1:flags=lanczos[x];[x][1:v]paletteuse" video.gif | |
# OR | |
# Using ffmpeg and gifsicle (https://www.lcdf.org/gifsicle/) | |
ffmpeg -i video.mp4 -s 600x400 -r 3 -f gif - | gifsicle --delay=3 > video.gif |
ffmpeg -i movie.mov -vcodec copy -acodec copy out.mp4 |
#!/usr/bin/env ruby | |
################################################### | |
## Display screen dimensions in macOS using ruby ## | |
################################################## | |
# found https://developer.apple.com/reference/coregraphics/1456395-cgdisplaybounds?language=objc | |
# --> use CoreGraphics framework | |
# --> CGRect CGDisplayBounds(CGDirectDisplayID display); | |
############################################# |
require 'matrix' | |
tolerance = Vector[5, 5, 5] | |
elements = [Vector[2, 1, 4], Vector[20, 100, 25], Vector[21, 98, 21], Vector[1, 2, 3]] | |
clusters = [] | |
while(elements.any?) | |
element = elements.pop | |
cluster, elements = elements.partition do |elem| | |
diff = tolerance - (elem - element).map(&:abs) |
#! /usr/bin/env bash | |
# brew install imagemagick | |
# brew install jpegoptim | |
mkdir 2048 | |
for image in *.[jJ][pP][eE]?[gG]; do | |
convert $image -resize 2048x2048\> ./2048/$image | |
jpegoptim --strip-all -q --max=80 ./2048/$image | |
done |
class Meter | |
attr_reader :value, :unit | |
def initialize(value, unit = 'm') | |
@value = value | |
@unit = unit | |
end | |
def self.[](value) | |
self.new(value) |
// | |
// main.m | |
// keyboard_layout_switcher | |
// | |
@import Carbon; | |
int main(int argc, const char * argv[]) { | |
@autoreleasepool { | |
if (argc <= 1){ |
values = 20.times.map{rand(100)+200} | |
delta = 10 | |
min, max = values.minmax | |
offset = min - delta / 2 | |
grouped = values.group_by { |value| (value - offset) / delta } | |
Hash[grouped.sort] | |
=begin |
require 'benchmark' | |
require 'open3' | |
require 'histogram/array' | |
array = Array.new(10_000_000) { rand(60) } | |
puts 'uniq, count:' | |
uniq_count = Benchmark.measure do | |
array.uniq.map { |key| array.count(key) } | |
end |