Skip to content

Instantly share code, notes, and snippets.

View WillsonSmith's full-sized avatar

Willson Smith WillsonSmith

View GitHub Profile
@WillsonSmith
WillsonSmith / instructionset.js
Created March 6, 2019 00:01
i honestly don't know why i did this. action functions with strings?
function sequence(...funcs) {
return function (value) {
return funcs.reverse().reduce(function(previous, current) {
return previous.call ? previous.call(this, current(value)) : previous;
});
};
};
function instructionSet(instructionSet) {
return (valueToWorkWith) => {
function searchThreads(offset, max, threads) {
const searchedThreads = GmailApp.search("in: inbox older_than:365d", offset, max);
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-365);
return searchedThreads.filter(function(thread) {
return thread.getLastMessageDate() < maxDate;
});
}
@WillsonSmith
WillsonSmith / scriptable-webview-template.js
Created October 26, 2018 18:07
template for a webview in scriptable.app
const styles = `
html {
font-family: -apple-system;
font-size: 10px;
}
body {
font-size: 1.6rem;
}
h1 {
@WillsonSmith
WillsonSmith / giferize.sh
Created March 21, 2017 15:18
turn video to high quality, low filesize gif
#!/bin/bash
palette="/tmp/palette.png"
filters="fps=25,scale=720:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
@WillsonSmith
WillsonSmith / side-by-side-ffmpeg.sh
Created March 21, 2017 14:56
put two videos side by side with ffmpeg
ffmpeg -i input1 -i input2 -filter_complex \
"[0:v]setpts=PTS-STARTPTS, pad=iw*2:ih[bg]; \
[1:v]setpts=PTS-STARTPTS[fg]; [bg][fg]overlay=w" output
import IO
defmodule SimilarfilmsPhoenix.GetData do
def build_key(key) do
transforms = %{"id" => "movie_id", "vote_average" => "rating", "poster_path" => "image_url"}
if (transforms[key]) do
transforms[key]
else
key
end
@WillsonSmith
WillsonSmith / compose.js
Created December 20, 2016 22:15
compose functions in JS
function compose(...funcs) {
return function (value) {
return funcs.reverse().reduce(function(previous, current) {
return previous.call(this, current(value));
});
};
};
-- window management
-- animation set 0 for instant sizing
hs.window.animationDuration = 0
function windowOrder()
local KEYBOARD_MODIFIER = {'cmd', 'alt', 'shift'}
function getPos()
local win = hs.window.focusedWindow()
@WillsonSmith
WillsonSmith / slackzoom.lua
Created December 1, 2016 20:45
a hammerspoon config to zoom slack on a larger monitor
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
end
@WillsonSmith
WillsonSmith / shout.js
Last active January 24, 2016 01:28
implementations of some string stuff
(function() {
function compose(...funcs) {
return function (value) {
return funcs.reverse().reduce(function(previous, current) {
return previous.call(this, current(value));
});
};
}
function shout(string) {