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
// ==UserScript== | |
// @name hackers-news | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description improve readability and night mode for hackers news | |
// @author You | |
// @match https://news.ycombinator.com/item?id=* | |
// @match https://news.ycombinator.com/* | |
// @grant none | |
// ==/UserScript== |
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
command_not_found_handle() { | |
# Do not run within a pipe | |
if test ! -t 1; then | |
echo "command not found: $1" >&2 | |
return 127 | |
fi | |
# run local file if exist | |
if [ -f "$1" ]; then | |
echo "running ./$1..." >&2 |
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 | |
set -e | |
set -o pipefail | |
case "$1" in | |
i|install) | |
shift | |
case "$1" in | |
-g|--global) | |
shift | |
npx --no npm i -g $@ |
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 | |
set -e | |
set -o pipefail | |
echo >&2 original: yarn $@ | |
if [ "$1" == 'install' ] || [ "$1" == 'add' ] ; then | |
shift | |
if [ "$1" == '--silent' ]; then | |
shift | |
fi | |
echo >&2 mapto: pnpm install --prefer-offline $@ |
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
command_not_found_handle() { | |
# Do not run within a pipe | |
if test ! -t 1; then | |
echo "command not found: $1" >&2 | |
return 127 | |
fi | |
# run local npm package if exist | |
cmd="node_modules/.bin/$1" | |
if [ -f "$cmd" ]; then |
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 node | |
let fs = require('fs'); | |
let path = require('path'); | |
let util = require('util'); | |
let target = { | |
files: [ | |
'workspace.xml', | |
], | |
dirs: [ |
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 | |
set -e | |
set -o pipefail | |
case "$1" in | |
-s|--sum) | |
git rev-list --objects --all \ | |
| git cat-file --batch-check='%(objecttype) %(objectsize) %(rest)' \ | |
| sed -n 's/^blob //p' \ | |
| awk '{x+=$1}END{print x}' \ | |
| $(command -v gnumfmt || echo numfmt) --field=1 --to=iec-i --suffix=B --round=nearest |
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 | |
set -e | |
set -o pipefail | |
FILTER_BRANCH_SQUELCH_WARNING=1 git filter-branch --force --index-filter "git rm --cached --ignore-unmatch $@" --prune-empty --tag-name-filter cat -- --all |
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
let time = 0 | |
Date.now = () => { | |
time++ | |
return time | |
} | |
class Cache { | |
pool = {} | |
size = 0 |
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
wget \ | |
--recursive \ | |
--level=inf \ | |
--waitretry=10 \ | |
--retry-connrefused \ | |
--page-requisites \ | |
--convert-links \ | |
--html-extension \ | |
--adjust-extension \ | |
--span-hosts \ |