Linux Notes

Currently using Kubuntu

Linux命令行有这么多的好东西?

fisher

Shadowsocks

  • ss-qt5
    sudo add-apt-repository ppa:hzwhuang/ss-qt5
    sudo apt-get update
    sudo apt-get install shadowsocks-qt5
  • https://github.com/shadowsocks/shadowsocks-libev
    • pyss 好像坏了....所以用这个
      • sudo apt install libsodium-dev
      • sudo apt-get install shadowsocks or sudo apt-get install shadowsocks-libev
  • provixy
    • install
      sudo apt-get install privoxy
    • config
      sudo subl /etc/privoxy/config
      listen-address localhost:8118
      ...
      forward-socks5t / 127.0.0.1:<PORT> .
    • /etc/privoxy/user.action
       
    • restart
      sudo privoxy --user privoxy /etc/privoxy/config
      sudo service privoxy restart
      sudo service privoxy start
      sudo service privoxy stop
      sudo service privoxy status
      ???
      [X] sudo systemctl enable privoxy
      [X] sudo systemctl start privoxy
      [X] sudo systemctl restart privoxy
    • export (~/.bashrc)
      function down_proxy(){
      unset http_proxy
      unset https_proxy
      unset APT_CONFIG
      # npm config delete proxy
      git config --global --unset http.https://github.com.proxy
      echo -e "proxy down!"
      }

      function up_proxy() {
      sudo service v2ray restart
      # sudo service privoxy restart
      # pkill ss-local
      # nohup ss-local -c ~/.shadowsocks/config.json >> ~/.shadowsocks/log.txt 2>&1 &
      export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
      export http_proxy="http://127.0.0.1:8118"
      export https_proxy=$http_proxy
      # npm config set proxy=http://127.0.0.1:8118
      # export APT_CONFIG=~/.apt_proxy.conf
      echo -e "proxy up!"
      }
    • ~/.config/fish/functions/up_proxy.fish
      function up_proxy
      sudo service privoxy restart
      sudo service v2ray restart
      # pkill ss-local
      # nohup ss-local -c ~/.shadowsocks/config.json >> ~/.shadowsocks/log.txt 2>&1 &
      pkill trojan
      nohup ~/Misc/trojan/trojan ~/Misc/trojan/config.json >> ~/Misc/trojan/log.txt 2>&1 &
      set -xU no_proxy "localhost,127.0.0.1,localaddress,.localdomain.com"
      set -xU http_proxy "http://127.0.0.1:8118" # 6666 for v2ray_http, 8118 for privoxy
      set -xU https_proxy "http://127.0.0.1:8118"
      npm config set proxy=http://127.0.0.1:8118
      # git config --global http.proxy http://127.0.0.1:8118
      git config --global https.proxy socks5://127.0.0.1:1080 # 2333 for v2ray_socks5, 1080 for ss/trojan sock5
      git config --global http.proxy socks5://127.0.0.1:1080 # 2333 for v2ray_socks5, 1080 for ss/trojan sock5
      echo -e "proxy up!"
      end
    • ~/.config/fish/functions/down_proxy.fish
      function down_proxy
      # sudo service v2ray stop
      # sudo service privoxy stop
      # pkill trojan
      set -xU no_proxy ""
      set -xU http_proxy ""
      set -xU https_proxy ""
      npm config delete proxy
      git config --global --unset http.proxy # keep sock5 running, for git config --global --unset https.proxy # keep sock5 running, for github ssh
      echo -e "proxy down!"
      end
    • /etc/apt/apt.conf
      Acquire::http::proxy "http://127.0.0.1:8118/";
      Acquire::https::proxy "https://127.0.0.1:8118/";
      in case apt doesn't use conf
      sudo apt-get -c ~/.apt_proxy.conf update
  • git, https://gist.github.com/laispace/666dd7b27e9116faece6
    • HTTP
    git config --global http.proxy http://127.0.0.1:8118
    • socks5
    git config --global http.proxy socks5://127.0.0.1:1080
    #or git config --global http.proxy socks5h://127.0.0.1:1080
    #specifically git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
    • SSH git@ -- ~/.ssh/config
    Host github.com
    ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p # (For linux. Change to "ProxyCommand connect -S 127.0.0.1:1080 %h %p" for Windows.)
  • gfwlist
    • for provixy: https://www.igfw.net/archives/1178
  • GenPAC
    sudo pip install genpac
    pip install —-upgrade genpac
    genpac --pac-proxy "SOCKS5 127.0.0.1:<PORT>" --gfwlist-proxy="SOCKS5 127.0.0.1:<PORT>" --gfwlist-url=https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt --output="autoproxy.pac”

在使用拼音了,因为觉得延迟和复制还是太麻烦?而且又省掉一个 chrome 标签页。

(安装 之后好像 kde 登录界面会变中文?待确认。有可能只能忍受。)

安装 fcitx:

sudo apt install fcitx-bin
sudo apt install fcitx-table

可能非必要:

sudo apt purge ibus
sudo apt autoremove

下载: https://pinyin.sogou.com/ 并安装

或者使用 google-pinyin

sudo apt install fcitx-googlepinyin

重启

sogou/google 默认配置应该没问题

fcitx 的 preedit 好像会搞掉 sublime? 干掉它!

subl ~/.config/fcitx/config

# TriggerKey=CTRL_SPACE
# TriggerKey=CTRL_ALT_SHIFT_SUPER_I
TriggerKey=
UseExtraTriggerKeyOnlyWhenUseItToInactivate=False
SwitchPreedit=CTRL_ALT_e
SwitchKey=Custom
CustomSwitchKey=CTRL_SPACE
IMSwitchKey=False

使用 sogou pinyin 而不是 google 的主要原因应该是因为
首先)完全用 pinyin 输入法包括输入英文明显是不现实的,比如在 shell 中,那么就需要分开输入法。
然后)就算不管 shell 和浏览器,假设他们不需要经常需要输入法,i.e.,输入法可以保持,那么 sublime 中其实是经常需要切换输入法的,就算是在打 中文的时候,假设在 sublime 中用中文输入法打英文也没什么问题,但是 打代码呢?git呢?那么就需要经常切,就算假设平时是用英文多,那么万一是中文也要看一眼比较好,虽然说按下去就能知道是什么输入法了,可是看一眼浮动条再开始也不错啊。

汗我发现就算开始用了其实也不是这么一回事,我还是倾向于直接开始敲而不是看一眼。看一眼的心智负担多重啊,敲完shift一下多方便。

但是聊天什么的 sogou 其实更加方便?关键字什么的。主要是有云端加持。好吧。想想也对,打字是为了快,要快的话,现在还是搜狗的资源好。