Skip to content

Instantly share code, notes, and snippets.

@hbouhadji
hbouhadji / vod.sh
Last active May 13, 2022 18:35
twitch vod viewer
#!/bin/bash
twitchVideoId=$(basename $1)
curl -ss --location --request GET "https://api.twitch.tv/kraken/videos/$twitchVideoId" \
--header 'Client-Id: kimne78kx3ncx6brgo4mv6wki5h1ko' \
--header 'Accept: application/vnd.twitchtv.v5+json' \
| jq -r '.animated_preview_url' \
| sed 's/\/storyboards.*/\/chunked\/index-dvr.m3u8/'
#!/bin/bash
osascript << EOF
set windowFounded to 0
set tabFounded to 0
tell application "$1"
set window_list to every window
set counter_window to 0
@hbouhadji
hbouhadji / code.ts
Created January 22, 2022 05:18
display aspect ratio by device pixels size
function _pgcd(a, b) {
if (b) {
return _pgcd(b, a % b);
} else {
return Math.abs(a);
}
}
const createRatio = (width, height, color) => {
return { ratio: width / height, width, height, color };
@hbouhadji
hbouhadji / fill.js
Last active February 12, 2021 12:58
Fill environment properties on beanstalk from .env file
// example in the body
// paste it in the chrome console
let raw = `
APP_NAME=Laravel
APP_ENV=local
`;
raw = raw.split('\n').filter(str => str.length > 0 && str[0] != '#')