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
View gist:524b5a49c6cb66580c66399db45523d3
xargs -0 -L1 -a /proc/PID/environ | grep HOSTNAME
View gist:3b7472a1b92b4e8923862378d0155fe8
(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)
View gist:2e9b041e6ac540319c0292472a94389b
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
View ans.py
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
View GPG and git on macOS.md

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
View init.el
(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)
View gist:9ee2c076d8c6ea8f4f4b3b58280d40c9
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
View gist:3b564bfea1c6e597f654d760c1ee1609
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build
@41tair
41tair / gist:c076f1ad313598238cf4d635986f22b0
Created January 22, 2019 10:43
install axel in centos/rhel
View gist:c076f1ad313598238cf4d635986f22b0
rpm -ivh ftp://fr2.rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/axel-2.4-1.el6.rf.x86_64.rpm
View gist:4ca1a57ea37d7fd434dfabd1cf47bca0
server {
listen 80;
server_name _;
if ($http_x_forwarded_proto = 'http'){
return 301 https://$host$request_uri;
}
}