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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Site Title</title> | |
<link href="https://cdn.jsdelivr.net/gh/hung1001/font-awesome-pro@4cac1a6/css/all.css" rel="stylesheet" type="text/css" /> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> | |
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> |
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
// call it until you get error | |
document.getElementById('showMoreStations').click() | |
const select = document.getElementById('nctCentresDropdown') | |
const options = []; for (const child of select.children) { options.push(child) } | |
const selectedIndex = options.findIndex(option => option.selected) | |
const magic = localStorage['magic'] ? JSON.parse(localStorage['magic']) : [] | |
magic.push([options[selectedIndex].innerText, document.getElementsByClassName('owl-item active')[0].innerText.replace('\n', ' ')]) | |
localStorage['magic'] = JSON.stringify(magic) | |
select.value = options[selectedIndex + 1].value | |
document.getElementsByTagName('form')[0].submit() |
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
const getMessage = message => Utilities.newBlob(message.getRawContent(), null, `${['Id', 'Subject', 'Date'].map(action => message['get' + action]()).join('_')}.eml`) | |
const getThread = thread => Utilities.zip(thread.getMessages().map(message => getMessage(message)), thread.getId() + '_' + thread.getFirstMessageSubject() + '.zip') | |
const getInbox = label => GmailApp.search(label).map(thread => getThread(thread)) | |
const labels = GmailApp.getUserLabels().map(label => 'label:' + label.getName()) | |
const emails = ['in:sent', 'in:inbox', ...labels].map(label => Utilities.zip(getInbox(label), label + '.zip')) |
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
const randInt = (min, max) => Math.floor(Math.random() * (max - min + 1) + min) // min and max included | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)) | |
const followersElement = getFollowersElementWithUsername(getUsername()) | |
followersElement.click() | |
function getUsername () { | |
const pageTitleElement = document.getElementsByTagName('h2')[0] | |
if (!pageTitleElement) throw new Error('No title to get username from') | |
return pageTitleElement.innerHTML |
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
"start | |
set number "set relativenumber | |
nmap <c-x> :wq<CR> | |
imap <c-x> <Esc>:wq<CR>a | |
set whichwrap+=<,>,h,l,[,] | |
syntax on | |
map <C-n> :NERDTreeToggle<CR> | |
" |
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
Promise.parallel = (functions, limit) => new Promise(resolve => { | |
limit = limit ? Math.min(limit, functions.length) : functions.length | |
let resolved = 0 | |
const taskDone = (index, value) => { | |
functions[index] = value // overwrite result into functions list | |
const nextIndex = resolved++ + limit | |
if (resolved === functions.length) { | |
return resolve(functions) | |
} |
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
import _thread | |
from time import sleep | |
def fmap(out, a, b): out.append(a * b) | |
def threading(pairs): | |
out = [] | |
for (a, b) in pairs: | |
thread = _thread.start_new_thread(fmap, (out, a, b, )) | |
return out |
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
#Ref: https://stackoverflow.com/questions/169511/how-do-i-iterate-over-a-range-of-numbers-defined-by-variables-in-bash | |
#Ref: https://stackoverflow.com/questions/30384634/how-to-split-a-video-into-individual-encoded-frames | |
#Ref: https://superuser.com/questions/678897/extract-hevc-bitstream-with-ffmpeg | |
input="newvideo8bit.mp4" | |
outDir="out3" | |
output="magic.h265" | |
rm -rf $outDir | |
mkdir $outDir | |
ffmpeg -i $input -f image2 -vcodec copy -bsf hevc_mp4toannexb $outDir/%d.h265 | |
END=249 |
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
import concurrent.futures | |
with concurrent.futures.ThreadPoolExecutor(max_workers = 8) as executor: | |
tasks = range(20) | |
future_to_task = {executor.submit(lambda task: task ** 2, task): task for task in tasks} | |
for future in concurrent.futures.as_completed(future_to_task): | |
task = future_to_task[future] | |
output = future.result() | |
print(task, output) |
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
# Set the keyboard layout | |
#> ls /usr/share/kbd/keymaps/**/*.map.gz | |
#> loadkeys de-latin1 | |
#> ls /sys/firmware/efi/efivars UEFI PROOF if exists | |
#Connect to the internet | |
#> ip link | |
# TEST Internet |
NewerOlder