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
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
#!/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
// ==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
#!/bin/bash | |
## extract files archived from git-compress | |
## TODO use tmp folder to support operation within a git repo | |
set -e | |
set -o pipefail | |
with_progress=0 | |
filename='' | |
if [ "$1" == "-p" ] || [ "$1" == "--progress" ]; 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
#!/bin/bash | |
## use git to compress a single folder or file | |
## TODO use tmp folder to support operation within a git repo | |
set -e | |
set -o pipefail | |
with_progress=0 | |
filename='' | |
dest='' |
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
function transfer | |
if test (count $argv) -eq 0 | |
echo "No arguments specified. Usage:\ntransfer /tmp/test.md\ncat /tmp/test.md | transfer test.md" | |
return 1 | |
end | |
## get temporarily filename, output is written to this file show progress can be showed | |
set tmpfile ( mktemp -t transferXXX ) | |
## upload stdin or file |
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
var ProgressBar = require('progress'); | |
var bar = new ProgressBar(' demo-ing progress [:bar] :percent :etas',{ | |
complete: '=', | |
incomplete: ' ', | |
width: 20, | |
total: 100, | |
}); | |
var timer = setInterval(()=>{ | |
if(bar.curr<bar.total) { | |
bar.tick(1); |
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
export let M = 0 | |
export let F = 0 | |
export type gender = 'm' | 'f' | |
export function add(gender: gender) { | |
switch (gender) { | |
case 'm': | |
return M++; | |
case 'f': | |
return F++; |
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" dir="ltr"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" | |
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<meta name="format-detection" content="telephone=no"> | |
<meta name="msapplication-tap-highlight" content="no"> | |
</head> | |
<body> |