Skip to content

Instantly share code, notes, and snippets.

@thfrei
thfrei / param serialize
Created January 6, 2017 10:45 — forked from yakirn/param serialize
A modified version of serialize and param methods from zeptos, that depends on _ as a global var (tested on [email protected])
/* the following serialize and param methods are a version of zepto's
* https://github.com/madrobby/zepto/blob/601372ac4e3f98d502c707bf841589fbc48a3a7d/src/ajax.js#L344-L370
* modified to use _ (tested on [email protected], should also work in underscore)
* to use with github's fetch:
fetch(urrl, {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded'
}
@thfrei
thfrei / bootstrap-vertical-grid.css
Created January 27, 2017 09:44 — forked from metaist/bootstrap-vertical-grid.css
Bootstrap vertical grid. For laying out full-screen fixed height webapps.
.container-fixed {
bottom: 0;
position: fixed;
left: 0;
right: 0;
top: 0;
}
.container-fixed .col {
height: 100%;
@thfrei
thfrei / prom-client_pm2_cluster.js
Created February 14, 2020 16:35 — forked from yekver/prom-client_pm2_cluster.js
Instead of `cluster` module there is no direct access to the master process in `pm2`. To return metrics for the whole cluster you can do IPC calls from the active instance to the rest of them and wait while all their locally collected metrics will be sent. Finally you have to aggregate all received metrics.
const prom = require('prom-client');
const pm2 = require('pm2');
let pm2Bus;
const REQ_TOPIC = 'get_prom_register';
function pm2exec(cmd, ...args) {
return new Promise((resolve, reject) => {
pm2[cmd](...args, (err, resp) => (err ? reject(err) : resolve(resp)));
@thfrei
thfrei / npm-scripts-for-docker.md
Created October 28, 2020 10:57 — forked from duluca/npm-scripts-for-docker.md
npm scripts for Docker

These are generic npm scripts that you can copy & paste into your package.json file as-is and get access to convinience scripts to manage your Docker images all in one place.

How to Use

npm i -g mrm-task-npm-docker
npx mrm npm-docker

Contribute

Here's the code repository https://github.com/expertly-simple/mrm-task-npm-docker

@thfrei
thfrei / noexport-subtrees.lua
Created October 4, 2021 09:55 — forked from tarleb/noexport-subtrees.lua
Emulating org-mode's :noexport: behavior for Markdown.
-- [[
Remove all subtrees whose headlines contain class `noexport`.
License: MIT
Copyright: © Albert Krewinkel
]]
-- pandoc.utils.make_sections exists since pandoc 2.8
PANDOC_VERSION:must_be_at_least {2,8}
@thfrei
thfrei / youtubemusicdownloader.py
Created October 19, 2023 11:29 — forked from un1tz3r0/youtubemusicdownloader.py
This script uses ytmusicapi and pytube together to download your playlists, history or 'liked' songs as high-quality audio-only streams from Youtube Music.
''' This script uses ytmusicapi and pytube together to download your playlists, history or 'liked' songs as
high-quality audio-only streams from Youtube Music, which are protected by a "signatureCipher" obfuscation scheme.
To use it, first install [ytmusicapi] and [pytube] using pip, then follow the instructions for creating the auth
file from the response in an authenticated session to a watch-page request as found in your browser's dev-tools.
The downloaded files are placed in ~/Music, named with the artist and track metadata, and will be skipped instead
of downloaded again next time it is run, based on the videoIds of the downloaded songs.
Merry Xmas - V.