Skip to content

Instantly share code, notes, and snippets.

@xpol
xpol / install.sh
Last active August 10, 2022 16:31
Enable audio video tag in Visual Studio Code on macOS
#!/usr/bin/env bash
curl -sL -o libffmpeg.zip https://github.com/iteufel/nwjs-ffmpeg-prebuilt/releases/download/0.38.1/0.38.1-osx-x64.zip
unzip libffmpeg.zip
mv ./libffmpeg.dylib "/Applications/Visual Studio Code.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libffmpeg.dylib"
@xpol
xpol / graphql-go-mongodb-example.go
Created September 22, 2018 07:22 — forked from trunet/graphql-go-mongodb-example.go
Minimal example of GraphQL Golang and MongoDB playing nicely together. Edit
// Embedded in this article https://medium.com/p/c98e491015b6
package main
import (
"context"
"fmt"
"log"
"net/http"
"time"
@xpol
xpol / tcomb-react Cheat Sheet.md
Created July 13, 2018 03:07
Tcomb React Cheat Sheet

Tcomb React Cheat Sheet

Type React tcomb-react
array array Array
boolean bool Boolean
functions func Function
numbers number Number
objects object Object
strings string String
@xpol
xpol / PinchZoomPan.js
Created May 5, 2017 04:37 — forked from iammerrick/PinchZoomPan.js
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
@xpol
xpol / rename-photos-by-exif-date-time.sh
Last active May 13, 2016 06:27
Rename photos by exif date
for fil in *.jpg; do datepath="$(identify -verbose $fil | grep DateTimeOri | awk '{print $2"-"$3 }' | sed s%:%%g)"; mv -v $fil $datepath.jpg; done
#!/usr/bin/env bash
# Install luarocks for luaenv.
function install() {
printf "install luarocks for $1..."
local ROOT=`luaenv root`
if [[ $1 == luajit* ]]; then
./configure --prefix=$ROOT/versions/$1 \
--with-lua=$ROOT/versions/$1 \
--rocks-tree=$ROOT/versions/$1 \
@xpol
xpol / ProFi.lua
Created January 14, 2016 06:39 — forked from perky/ProFi.lua
ProFi, a simple lua profiler that works with LuaJIT and prints a pretty report file in columns.
--[[
ProFi v1.3, by Luke Perkin 2012. MIT Licence http://www.opensource.org/licenses/mit-license.php.
Example:
ProFi = require 'ProFi'
ProFi:start()
some_function()
another_function()
coroutine.resume( some_coroutine )
ProFi:stop()
function proxy {
case $1 in
[1-9]*)
export http_proxy=socks5://127.0.0.1:$1
export https_proxy=$http_proxy
git config --global http.proxy $http_proxy
git config --global https.proxy $https_proxy
;;
off)
Write-Output 'Good!'
@xpol
xpol / 00_ha_dnscrypt_proxy_client_setup.markdown
Created December 25, 2015 06:51
Highly-available dnscrypt-proxy client setup on OSX with DNSSEC.

Tested, works!

Install

git clone https://gist.github.com/fccbf0f02355a31f7959 && cd fccbf0f02355a31f7959 && sh install.sh && cd .. && rm -rf fccbf0f02355a31f7959

Uninstall

git clone https://gist.github.com/fccbf0f02355a31f7959 && cd fccbf0f02355a31f7959 && sh uninstall.sh && cd .. && rm -rf fccbf0f02355a31f7959