Skip to content

Instantly share code, notes, and snippets.

@sybblow
sybblow / sync-dotfiles.sh
Created August 12, 2022 11:16
synchronize configurations
git clone --bare git@github.com:sybblow/my-dotfiles.git $HOME/.dotfiles
alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
# alias lazyconfig='lazygit --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
config pull --rebase && config checkout
#!/bin/bash
branch=$1
branchName=$1
if [[ $branchName == refs/heads/* ]]; then
branchName=${branchName:11}
fi
branchRemote=`git config branch.$branchName.remote`
branchMerge=`git config branch.$branchName.merge`
#!/usr/bin/env bash
# Makes unmaintainable Go plugin for phpstorm compatible with actual versions.
# https://github.com/go-lang-plugin-org/go-lang-idea-plugin
#
# Run ./go_compiler.sh path/to/downloaded/Go/plugin.zip version_of_phpstorm(e.g. 182, 173, etc.)
# For instance
# ./go_compiler.sh /home/user/downloads/Go-0.13.1947.zip 173
# New relevant file will be created in the same directory as initial archive. It will have name Go.zip.
openssl passwd -1 xxxxxxxxxxxxxxx
import sys
import os
import json
import importlib
imported_module = importlib.import_module(sys.argv[1])
os.chdir("output")
for sym in dir(imported_module):
if not sym.startswith("__"):
@sybblow
sybblow / mixin.go
Created November 9, 2016 04:36 — forked from hzm-s/mixin.go
mixin with golang
package main
import "fmt"
// 料理を作るI/F
type Cooker interface {
Cook() string
}
// 塗るI/F
@sybblow
sybblow / mixin.go
Created November 9, 2016 04:36
golang mixin sample
package main
import "fmt"
type Shape interface {
draw()
}
type Circle struct{}
@sybblow
sybblow / ss-redir 透明代理.md
Last active October 20, 2016 02:38 — forked from wen-long/ss-redir 透明代理.md
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 内网监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
@sybblow
sybblow / nil_interface_trap.go
Created June 28, 2016 06:46
golang nil interface trap
package main
import (
"fmt"
"io"
)
type MyWriter struct{}
func (w *MyWriter) Write(p []byte) (n int, err error) {
@sybblow
sybblow / 256color.pl
Last active August 29, 2015 14:17 — forked from hSATAC/256color.pl
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {