This file contains hidden or 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
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('./sw.js') | |
.then(function(registration) { | |
console.log("Service Worker Registered", registration); | |
}) | |
.catch(function(err) { | |
console.log("Service Worker Failed to Register", err); | |
}) | |
} |
This file contains hidden or 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 | |
# -*- coding: utf-8 -*- | |
# Open 9GAG NSFW image link without login | |
# How to use: 9gag.py "<url>" | |
import webbrowser | |
import sys, re | |
m = re.search('\/\w{7}', sys.argv[1]) | |
link = "http://img-9gag-lol.9cache.com/photo" + m.group(0) + "_460s.jpg" | |
print(link) | |
webbrowser.open(link) |
This file contains hidden or 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 | |
# Never heard of Tridctyl? Check this out https://addons.mozilla.org/en-US/firefox/addon/tridactyl-vim/ | |
# This script can apply Tridactyl configuration in seconds: | |
# Step 1: Modify key bindings and string value in the variable "data" as json format. | |
# Step 2: ./update-tridactyl-conf.sh <path/storage-sync-v2.sqlite> | |
if [[ -z $(command -v sqlite3) ]]; then | |
echo "Command \"sqlite3\" does not exist!" | |
echo "Downlad: https://sqlite.org/download.html" | |
exit 1 |
This file contains hidden or 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
body { | |
overflow: hidden; | |
margin: 0; | |
} | |
input { | |
width: 100%; | |
padding: 0; | |
font-family: monospace; | |
font-size: 9pt; |
This file contains hidden or 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
span.TridactylHint { | |
position: absolute; | |
font-family: sans-serif; | |
font-size: 12px; | |
font-weight: bold; | |
text-transform: uppercase; | |
color: white; | |
background-color: #204e8a; | |
border-color: ButtonShadow; | |
border-width: 0px; |
This file contains hidden or 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 bash | |
# HOW TO USE: | |
# ~$ chmod +x jwtDecoder.sh | |
# ~$ ./jwtDecoder.sh "<JWT token>" | |
padding() { | |
# $1: base64 string | |
local m p="" | |
m=$(( ${#1} % 4 )) | |
[[ "$m" == 2 ]] && p="==" |
This file contains hidden or 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
body { background: #222; color: #e6e6e6; } | |
a { color: #949494; } | |
a:link, a:visited { color: #949494; } | |
a:hover, a:active, a:focus { color: #c7c7c7; } | |
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; } |
This file contains hidden or 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 bash | |
# | |
#/ This scrip will send selected ebook to device | |
#/ Go to ebook folder created by calibre and run this script | |
#/ | |
#/ Usage: | |
#/ ./calibrecli.sh "<ebook_file>" "<device_path>" | |
set -e | |
set -u |
This file contains hidden or 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 bash | |
# Data fetched from the dashboard "Coronavirus 2019-nCoV Global Cases" https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html#/bda7594740fd40299423467b48e9ecf6 | |
echo "Country/Region: Confirmed / Deaths / Recovered" | |
curl -sS 'https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/2/query?f=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&orderByFields=Confirmed%20desc&resultOffset=0&resultRecordCount=250&cacheHint=true' | jq -r '.features[].attributes | "\(.Country_Region)+\(.Confirmed)+\(.Deaths)+\(.Recovered)"' | column -t -s '+' | |
echo -e "\n" | |
curl -sS 'https://services1.arcgis.com/0MSEUqKaxRlEPj5g/arcgis/rest/services/ncov_cases/FeatureServer/1/query?f=json&where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=*&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22Confirmed%22%2C%22outStatisticFieldName%22%3A%22value%22%7D%5D&cacheHint=true' | jq -r '" |
This file contains hidden or 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 puppeteer = require('puppeteer-core'); | |
(async() => { | |
const cPath = '/usr/bin/chromium'; | |
const isHeadless = true; | |
const url = 'http://zzzscore.com/1to50/en'; | |
const browser = await puppeteer.launch({executablePath: cPath, headless: isHeadless}); | |
const page = await browser.newPage(); | |
await page.goto(url, {timeout: 30000, waitUntil: 'domcontentloaded'}); |