Skip to content

Instantly share code, notes, and snippets.

@ins429
ins429 / index.html
Created February 16, 2013 00:26
A CodePen by Julian Garnier. 3D CSS Hartwig chess set (fully playable) - 3D chess game done in HTML/CSS/JS. Works only in webkit. Github repo: https://github.com/juliangarnier/3D-Hartwig-chess-set Using Photon : http://photon.attasi.com and Chess.js : https://github.com/jhlywa/chess.js
<body>
<div id="app" class="loading" data-theme="classic" data-frame="off" data-menu="main">
<div id="logo">
<div class="symbol"><div></div><div></div><div></div><div></div><div></div><div></div></div>
<div class="symbol"><div></div><div></div><div></div><div></div><div></div><div></div></div>
<div class="symbol"><div></div><div></div><div></div><div></div><div></div><div></div></div>
<div class="symbol"><div></div><div></div><div></div><div></div><div></div><div></div></div>
<div class="symbol"><div></div><div></div><div></div><div></div><div></div><div></div></div>
</div>
<div id="overlay"></div>
@ins429
ins429 / url_signer.ex
Created October 7, 2016 00:55
Google url signer for Elixir
defmodule GoogleMaps.UrlSigner do
@module_doc """
Generate a signed url for google maps API.
https://developers.google.com/maps/documentation/streetview/get-api-key#generating_valid_signatures
"""
def call(private_key, url) do
parsed_url = URI.parse(url)
path_and_query = "#{parsed_url.path}?#{parsed_url.query}"
# Create a signature using the private key and the URL(path and query).

Keybase proof

I hereby claim:

  • I am ins429 on github.
  • I am ins429 (https://keybase.io/ins429) on keybase.
  • I have a public key ASDmrJ1iKNCcQ7Uw5OElg-vUONVLOqNrK5qTyMMFaHRRSgo

To claim this, I am signing this object:

@ins429
ins429 / deeplink.js
Last active July 28, 2017 21:16
deep link test
Room
WaitingRoomForLockedRoom
conference full -> conference is full
waiting owner
owner joined -> request to join
request to join
request -> requesting to join
requesting to join
accepted -> consent to recording
rejected -> rejected
@ins429
ins429 / decodeBrotli.js
Created August 31, 2022 16:49
Decode brotli compressed
// Google's Brotli decoder https://github.com/google/brotli/blob/master/js/decode.min.js
let BrotliDecode=(()=>{function f(f){this.data=f,this.offset=0}let w=Int32Array.from([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]),b=Int32Array.from([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),j=Int32Array.from([0,3,2,1,0,0,0,0,0,0,3,3,3,3,3,3]),l=Int32Array.from([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),m=Int32Array.from([131072,131076,131075,196610,131072,131076,131075,262145,131072,131076,131075,196610,131072,131076,131075,262149]),p=Int32Array.from([1,5,9,13,17,25,33,41,49,65,81,97,113,145,177,209,241,305,369,497,753,1265,2289,4337,8433,16625]),q=Int32Array.from([2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,6,6,7,8,9,10,11,12,13,24]),o=Int16Array.from([0,0,0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,7,8,9,10,12,14,24]),n=Int16Array.from([0,0,0,0,0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,7,8,9,10,24]),g=new Int16Array(2816);function k(f){let w=-1,b=16;for(;b>0;)f>>>b!=0&&(w+=b,f>>>=b),b>>=1;return w+f}fu
@ins429
ins429 / getIntegrity.js
Created August 31, 2022 17:40
Getting the hash of a file(request.integrity)
const fs = require("fs");
const crypto = require("crypto");
// the file you want to get the hash
const stream = fs.createReadStream("xxx.ext");
const hash = crypto.createHash("sha256");
console.log("hash", hash);
hash.setEncoding("base64");
alias video_to_gif='function video_to_gif(){ ffmpeg -i $1 $2 && gifsicle -O3 $2 -o $2 && say "Video is ready!"};video_to_gif'
gif_to_video() {
ffmpeg -i $1 -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" $2
}