Skip to content

Instantly share code, notes, and snippets.

View parallel-goget.sh
#!/bin/bash
GOBIN=/usr/golang/bin/go
function go() {
if [ "$1" = "get" ]; then
shift
echo "run go get ::: $*" >&2
parallel --will-cite -j 4 "$GOBIN" get -u -v ":::" "$@"
else
"$GOBIN" "$@"
fi
@GongT
GongT / README.dm
Created Oct 29, 2018
a service file to redirect Privoxy log file to journald
View README.dm
```bash
journalctl -ft privoxy
```
@GongT
GongT / steps.md
Last active Sep 3, 2018
Create A Library With Typescript And Rollup
View steps.md

You want:

  1. write some code as library
  2. split your code into many files

Then you can just write every file standalone, compile them all (to commonjs format), and others can use. perfect.

If you also want:

  1. manage imports using absolute path in your module (eg. import xxx from "vs/code/workbench")
    • without requires user mock require call to handle absolute import path
  2. remove "src" or "out" from import path
@GongT
GongT / tiny-tsc-intro.ts
Created Sep 1, 2018
the first part of typescript analyze process.
View tiny-tsc-intro.ts
import {
createCompilerHost,
createProgram,
Diagnostic,
formatDiagnostic,
FormatDiagnosticsHost,
getParsedCommandLineOfConfigFile,
ParseConfigFileHost,
ParsedCommandLine,
Program,
@GongT
GongT / setup
Created May 5, 2018
cygwin install new package
View setup
#!/bin/bash
LOCAL_REPO='http://mirrors.aliyun.com/cygwin/'
LOCAL_PACKAGE_DIR='A:/cygwin-repo'
if [ ! -e /setup-x86_64.exe ]; then
if command -v wget &>/dev/null ; then
wget -c "http://cygwin.org/setup-x86_64.exe" -O /setup-x86_64.exe
else
echo "No setup-x86_64.exe, and no wget." >&2
@GongT
GongT / mount.sh
Created Apr 24, 2018
mount qemu disk
View mount.sh
#!/bin/sh
export O_P_W_D=$(pwd)
trap "
cd '$O_P_W_D'
pwd
echo 'cleanup...'
while ! umount root ; do sleep 1 ; done
while ! qemu-nbd --disconnect /dev/nbd0 ; do sleep 1 ; done
@GongT
GongT / pstorm
Last active Feb 23, 2018
Idea IDE commandline shortcut
View pstorm
#!/usr/bin/env bash
#################################
IDEA_PATH="/opt/PhpStorm/bin/phpstorm.sh"
#################################
set -e
@GongT
GongT / remote-connect.md
Last active Jun 11, 2017
from linux shell, remote open chrome on windows
View remote-connect.md

On windows

create a link to chrome inside WSL. this will only run after Creators Update

echo '#!/bin/bash

cd /mnt/c
exec "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe" "$@"
' > /usr/local/bin/chrome
chmod a+x /usr/local/bin/chrome
@GongT
GongT / sshd.xml
Last active Jun 11, 2017
start sshd when current user login (windows scheduler)
View sshd.xml
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2017-06-11T10:37:48.0530393</Date>
<Author><!------------ SHABAO-DESKTOP\gongt ------------></Author>
<URI>\sshd</URI>
</RegistrationInfo>
<Triggers>
<BootTrigger>
<Enabled>true</Enabled>
@GongT
GongT / bashrc.sh
Created Jun 10, 2017
tmux wrapper. attach without arguments.
View bashrc.sh
function tmux {
if [ $# -eq 0 ]; then
if /usr/bin/tmux list-sessions &>/dev/null ; then
/usr/bin/tmux attach
else
cd ~
/usr/bin/tmux
fi
else
/usr/bin/tmux "$@"