Skip to content

Instantly share code, notes, and snippets.

@41tair
41tair / gist:524b5a49c6cb66580c66399db45523d3
Last active August 2, 2023 10:35
get pod hostname by pid
xargs -0 -L1 -a /proc/PID/environ | grep HOSTNAME
(global-hl-line-mode t)
(require 'cc-mode)
(global-linum-mode t) ;; enable line numbers globally
(column-number-mode 1)
(setq inhibit-startup-message t) ;; hide the startup message
(display-time-mode t)
eval-buffer 加载当前的文件
(setq debug-on-error t) 打开调试模式
打开行号 (global-linum-mode t)
加载util util
配置 elpa https://melpa.org/#/
ivy https://github.com/abo-abo/swiper
sr-speedbar https://www.emacswiki.org/emacs/SrSpeedbar
magit https://github.com/magit/magit
multi-term https://www.emacswiki.org/emacs/MultiTerm
ag.el https://github.com/Wilfred/ag.el
@41tair
41tair / ans.py
Created October 30, 2019 20:22
stupid algorithm
t1 = ["123",["ddd", "ccc","344", ["lll"], ['zzz']],"333"]
def a(l):
c = []
z = []
if any([isinstance(x, list) for x in l]):
for i in l:
if len(i) == 1:
z.append(i)
if not isinstance(i, list):
@41tair
41tair / GPG and git on macOS.md
Created September 25, 2019 10:37 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys
@41tair
41tair / init.el
Last active September 9, 2019 10:19
emacs on linux minimal config
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(ivy-mode 1)
(add-hook 'after-init-hook 'global-company-mode)
(global-linum-mode t)
(global-set-key [f3] 'execute-extended-command)
(global-set-key [f4] 'ag-project)
(global-set-key [f5] 'kmacro-start-macro)
(global-set-key [f6] 'kmacro-end-and-call-macro)
dd if=/dev/zero of=a.bin bs=4096 count=524288 conv=fdatasync
dd if=a.bin of=/dev/null bs=4096 count=524288 iflag=direct
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
@41tair
41tair / gist:c076f1ad313598238cf4d635986f22b0
Created January 22, 2019 10:43
install axel in centos/rhel
rpm -ivh ftp://fr2.rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/axel-2.4-1.el6.rf.x86_64.rpm
server {
listen 80;
server_name _;
if ($http_x_forwarded_proto = 'http'){
return 301 https://$host$request_uri;
}
}