This file contains 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
// This work is licensed under the Creative Commons Attribution 3.0 United States License. To view | |
// a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ or send a letter | |
// to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. | |
// Copyright 2009 John Tantalo <john.tantalo@gmail.com> | |
(function () { | |
// get selection | |
var selection = window.getSelection ? window.getSelection() : | |
document.getSelection ? document.getSelection() : |
This file contains 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
export const alias = { | |
"openapi": "2.0", | |
"paths": { | |
"/path1": { | |
"get": { | |
"parameters": [ | |
{ | |
"in": "path", | |
"name": "my_param", | |
"schema": { "$ref": "#/x-MyDefs/person_id" } |
This file contains 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
// install repos: https://github.com/jb55/javascript-iterators/wiki/Registry | |
const iterator = R.map({ | |
map: require('map-iterator'), | |
filter: require('filter-iterator'), | |
groupBy: require('groupby-iterator'), | |
sortBy: require('sortby-iterator'), | |
concat: require('concat-iterator'), | |
skip: require('skip-iterator'), | |
take: require('take-iterator'), |
This file contains 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
let R = require('ramda'); | |
const up = (s) => s[0].toUpperCase() + s.substring(1).replace(/\-(\w)/, (match, letter) => letter.toUpperCase()); | |
// JSON.stringify(crudOpenApiEndpoints({ single: 'app' })) | |
function crudOpenApiEndpoints ({ single, plural = single + 's', id = 'id', type = 'integer' }) { | |
let $ref = `#/definitions/${up(single)}`; | |
let resp = (schema) => ({ description: 'OK', schema }); | |
let responses = { 204: resp({}) }; // empty non-GET response | |
let idPar = { name: id, in: 'path', required: true, type }; |
This file contains 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
var R = require('ramda'); | |
var deps = R.pipe( | |
R.match(/Depends: ([\w-]+)/g), | |
R.map(R.replace('Depends: ', '')), | |
R.join(' '), | |
R.concat('sudo apt-get install '), | |
); | |
/* |
This file contains 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
// get the CSS snippet needed to give one element the style of another | |
var R = require('ramda'); | |
var getPx = (str) => /(\d+)\s*px/g.test(str) ? Number(str.replace(/[^\d]/g, '')) : null; | |
var px2rem = R.curry((base, str) => str.replace(/(\d+)\s*px/g, (match, px) => Number(px)/base + 'rem')); | |
var base = getPx(getComputedStyle(document.documentElement).fontSize); | |
var toRem = px2rem(base); | |
var patchStyle = (fromEl, toEl, asRem = false) => { | |
let [styles, stylesTo] = [fromEl, toEl].map(getComputedStyle); | |
let css = R.pipe( |
This file contains 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 docker_alias () { | |
file=$1 | |
img=$2 | |
[[ "${3+set}" = set ]] && tag=$3 || tag="latest" | |
[[ "${4+set}" = set ]] && cmd=$4 || cmd=$file | |
printf "docker images | grep $img > /dev/null || docker pull $img:$tag\nid=\`docker images | grep -E "$img" | awk '{print \$3}'\`\ndocker run \$id $cmd \$@" | sudo tee /usr/bin/$file > /dev/null | |
sudo chmod +x /usr/bin/$file | |
} | |
# example usage: |
This file contains 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
sudo ~/Android/Sdk/platform-tools/fastboot flash system ./SYSTEM.img | |
sudo ~/Android/Sdk/platform-tools/fastboot flash boot ./BOOT.img | |
sudo ~/Android/Sdk/platform-tools/fastboot flash recovery ./RECOVERY.img | |
sudo ~/Android/Sdk/platform-tools/fastboot flash cust ./CUST.img | |
sudo ~/Android/Sdk/platform-tools/fastboot flash cache ./CACHE.img | |
sudo ~/Android/Sdk/platform-tools/fastboot flash userdata ./USERDATA.img | |
sudo ~/Android/Sdk/platform-tools/fastboot reboot |
This file contains 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
STREAM_KEY=`cat ~/.twitch_key` | |
INRES=`xwininfo -root | awk '/geometry/ {print $2}'i` # input resolution | |
OUTRES="1280" # output resolution horizontal. vertical is calculated. screen width 1920. | |
FPS="10" # target FPS | |
GOP="20" # i-frame interval, should be double of FPS, | |
GOPMIN="10" # min i-frame interval, should be equal to fps, | |
THREADS="2" # max 6 | |
CBR="1000k" # constant bitrate (should be between 1000k - 3000k) | |
QUALITY="ultrafast" # one of the many FFMPEG preset, e.g. ultrafast, veryfast | |
AUDIO_SRATE="44100" |
This file contains 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
# Agent: | |
# static: | |
# declare | |
defmodule Mix.TasksServer do | |
def start_link do | |
Agent.start_link(fn -> HashSet.new end, name: __MODULE__) | |
end | |
def put_task(task, project) do | |
item = {task, project} |
OlderNewer