Skip to content

Instantly share code, notes, and snippets.

View latpaw's full-sized avatar
🌻
404

Latpaw latpaw

🌻
404
View GitHub Profile
(defun open-with-vscode ()
"Open current file with vscode."
(interactive)
(let ((line (number-to-string (line-number-at-pos)))
(column (number-to-string (current-column))))
(apply 'call-process "code" nil nil nil (list (concat buffer-file-name ":" line ":" column) "--goto"))))
(global-set-key (kbd "C-c j v") 'open-with-vscode)
@latpaw
latpaw / git-change-commit-all-author.sh
Created April 12, 2021 02:49
replace all email in git
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@latpaw
latpaw / cors_http_server.py
Created December 29, 2020 08:26
http server with cors by python simpleHttpServer
#!/usr/bin/env python
# Usage: python cors_http_server.py <port>
try:
# try to use Python 3
from http.server import HTTPServer, SimpleHTTPRequestHandler, test as test_orig
import sys
def test (*args):
test_orig(*args, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)
@latpaw
latpaw / processbar.sh
Created May 22, 2020 02:28
processbar
echo -ne "-1\r"
sleep 1
echo -ne "--2\r"
sleep 1
echo -ne "---3\r"
@latpaw
latpaw / git-show.sh
Last active October 31, 2018 11:39
some shell
# show all latest commits in each branch
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@latpaw
latpaw / symantec.sh
Last active August 17, 2018 06:58
unload symentec
sudo launchctl unload /Library/LaunchDaemons/com.symantec.symdaemon.plist
sudo launchctl unload /Library/LaunchDaemons/com.symantec.sharedsettings.plist
launchctl unload /Library/LaunchAgents/com.symantec.uiagent.application.plist
@latpaw
latpaw / tmux-cheatsheet.markdown
Created July 31, 2018 11:47 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@latpaw
latpaw / content.json
Last active June 5, 2018 05:58
car_robot.sh
[
{
"content": [
{
"content": [
"奥迪Q5L",
"奥迪A3",
"奥迪A4L",
"奥迪A6L",
"奥迪A6L新能源",
//fix the problem ,webpack + sourceMap backgound-image do not load
//replace the action in addStyles.js updateLink function
css = css.replace(/url\((?!data\:)/g,"url("+document.location.origin+"/")
@latpaw
latpaw / auto_switch_kb.py
Created April 19, 2016 07:04 — forked from tiann/auto_switch_kb.py
auto switch keyboard to english in specific applications
#! /usr/bin/env python
# coding: utf-8
'''
auto switch keyboard between different applications
if you want to change the app list, modify the var 'ignore_list'
'''
from AppKit import NSWorkspace, NSWorkspaceDidActivateApplicationNotification, NSWorkspaceApplicationKey