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
#!/bin/bash | |
## create a keyboard shortcut [ctrl + up + q] | |
## to launch a search with clipboard content | |
QUERY=`xclip -o` | |
URL='https://www.google.com/search?&q=' | |
URL+="$QUERY" | |
firefox --new-tab "$URL" |
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
#!/usr/bin/env python3 | |
## | |
# Show wireguard statistics with usernames assigned to their public keys | |
# $> ./wg-show.py with no options will use | |
# wg0_file="/etc/wireguard/wg0.conf" | |
# wg_iface="wg0" | |
# sg_to_timeout=300 seconds | |
# | |
# ./wg-show.py --help | |
# usage: wg-show.py [-h] [--config CONFIG] [--interface INTERFACE] |
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
// <p class="transform_date" data-date="2020-07-30 18:08:22"></p> | |
$(".transform_date").each(function() { | |
let created_at = $(this).data("date") | |
let ago = moment.tz(created_at, "YYYY-MM-DD HH:mm:ss", "UTC").fromNow(); | |
$(this).html(ago) | |
}); |
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
'use strict'; | |
/** | |
* Nodejs Stream Workers example | |
* will cipher and return deciphered file.txt to console output | |
* using a worker as a writeable stream. | |
* | |
* Use: | |
* node boss.js < file.txt | |
* | |
* if node < 12 |
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
//Prerequisite: cli-progress ^3.0.0 | |
const fs = require('fs'); | |
const _cliProgress = require('cli-progress'); | |
let script_mode = false; | |
/** | |
* Make a big file, or small... | |
* | |
* Cli: | |
* > node makeBigFile.js --dest '/tmp/foo.txt' --size 1gb |
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
// Code from https://github.com/laravel/passport/issues/779#issuecomment-429536388 | |
<?php | |
namespace App; | |
use Laravel\Passport\Passport; | |
use Lcobucci\JWT\Builder; | |
use Lcobucci\JWT\Signer\Key; | |
use Lcobucci\JWT\Signer\Rsa\Sha256; | |
use League\OAuth2\Server\CryptKey; |