Skip to content

Instantly share code, notes, and snippets.

View angel333's full-sized avatar

Ondra Simek angel333

View GitHub Profile
/*
* Simple hash function that uses Web Cryptography API
* @param {string} algo - SHA-1/SHA-256/SHA-384/SHA-512
* @param {string} text - text to compute digest from
* @return {Promise} - A promise returning text.
*/
function hash (algo, text) {
const encoded = new TextEncoder().encode(text);
return window.crypto.subtle.digest(algo, encoded)
.then(result =>
#!/bin/bash
#
# Certbot hook for Hurricane Electric DNS service
#
# Usage:
#
# Renew all certificates:
# HE_SESSID=<session_id> certbot renew \
# --preferred-challenges dns \
@angel333
angel333 / youtube-playlist-duration.js
Last active August 15, 2021 19:33
Youtube playlist duration
// Just copy this into console while on a playlist page (https://www.youtube.com/playlist?list=.....)
alert(((document) => {
let seconds = Array.from(document.querySelectorAll('.pl-video-time .timestamp span'))
.map((span) => {
let time = span.textContent.split(':');
return (Number(time[0]) * 60) + Number(time[1]);
})
.reduce((a,b) => {
return a + b;

The Best 18650 Batteries (last update: 2016-12-08)

This is similar to best18650battery.com but much simpler and better updated. These are the absolute top 18650s.

Name Model Capacity Discharge Fasttech links Note
Sony [US18650VTC6][d-vtc6] 3120mAh 30A [1pcs][vtc6-1], [2-pack][vtc6-2], [4-pack][vtc6-4]
LG Chem [INR18650MJ1][d-mj1] 3500mAh 10A [1pcs][mj1-1], [2-pack][mj1-2], [4-pack][mj1-4]
Sanyo (Panasonic) [NCR18650GA][d-ga] 3500mAh* 10A [1pcs][ga-1], [2-pack][ga-2], [4-pack][ga-4] NCR**
Samsung SDI [INR18650-35E][d-35e] >3350mAh 8A [1pcs][
@angel333
angel333 / infimouse.au3
Created December 6, 2016 13:52
If you move mouse to one border, it'll come from the other.
;
; Infimouse.au3
; an AutoIt script
;
; Author: Ondrej Simek
; License: MIT
;
; If you move mouse to one border, it'll come from the other.
;
; Works for multiple screens too, but will have issues if the screen
@angel333
angel333 / yum-installed
Last active November 19, 2016 14:53
This one-liner will list packages that were explicitly installed by user.
#/bin/sh
# Description: Lists packages that were explicitly installed by user.
# Run this: curl -Ls goo.gl/RV7oiB | sh
export LC_ALL=C
MIN=2 # First is the OS installation
MAX=$(yum history | awk 'NR==4 { print $1 }')
<html>
<head>
<title>hi</title>
</head>
<body>
hi
</body>
</html>
<script src='bench.js'></script>
* INFO: - ./bootstrap.sh -- Version 2014.10.14
* WARN: Running the unstable version of bootstrap-salt.sh
* INFO: System Information:
* INFO: CPU: GenuineIntel
* INFO: CPU Arch: x86_64
* INFO: OS Name: Linux
* INFO: OS Version: 3.16.3-1-ARCH
* INFO: Distribution: Debian 7.7
#!/bin/bash
#
# === MITize ===
# Create an MIT license file with one command.
# No parameters, just run it and forget about it.
#
# Check if there is not a license file already
[[ -f LICENSE || -f LICENSE.txt || -f LICENSE.md ]] &&