Skip to content

Instantly share code, notes, and snippets.

View zycbobby's full-sized avatar

Curry zycbobby

  • NetEase
  • Guangzhou
View GitHub Profile
@zycbobby
zycbobby / delete_git_submodule.md
Created August 28, 2019 06:50 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
set-option -g default-shell /bin/zsh
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
@zycbobby
zycbobby / init_server.sh
Last active August 2, 2018 01:49
init server
# install screen
wget https://gist.github.com/zycbobby/f9853c07008ff52a088d1ed7cedfd6ba/raw/8275b66c3ea86a562cdaa16f1cc6d9931d521e1b/.screenrc-main-example
mv .screenrc-main-example .screenrc
# install tmux locally
wget https://gist.github.com/zycbobby/6931732410cab61b91a078203c5985b8/raw/ad38f468ee8a4348aa7e7d9f9f7af95de6633c2b/tmux_local_install.sh
sh tmux_local_install.sh
# fzf
@zycbobby
zycbobby / tmux_local_install.sh
Last active June 13, 2018 07:36 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.5
@zycbobby
zycbobby / .screenrc-main-example
Last active September 5, 2018 05:08 — forked from ChrisWills/.screenrc-main-example
A nice default screenrc
# GNU Screen - main configuration file
# All other .screenrc files will source this file to inherit settings.
# Author: Christian Wills - [email protected]
# Allow bold colors - necessary for some reason
attrcolor b ".I"
# Tell screen how to set colors. AB = background, AF=foreground
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
type T struct {
a int
b float64
c string
}
t := &T{ 7, -2.35, "abc\tdef" }
func (t *T) String() string {
return fmt.Sprintf("%d/%g/%q", t.a, t.b, t.c) # %d for value, $g for %g 根据情况选择 %e 或 %f 以产生更紧凑的(无末尾的0)输出
# %q 双引号围绕的字符串,由Go语法安全地转义
func offset(tz string) int {
if seconds, ok := timeZone[tz]; ok {
return seconds
}
log.Println("unknown time zone:", tz)
return 0
}
@zycbobby
zycbobby / pig.go
Created November 3, 2015 06:09
Game Pig
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"math/rand"
)
func NewFile(fd int, name string) *File {
if fd < 0 {
return nil
}
f := File{fd, name, nil, 0}
return &f
}