Skip to content

Instantly share code, notes, and snippets.

View imjma's full-sized avatar
💻
Coding

Jie Ma imjma

💻
Coding
View GitHub Profile
@imjma
imjma / Dockerfile
Created March 13, 2023 01:00
lambda golang docker local
FROM public.ecr.aws/lambda/provided:al2 as build
# install compiler
RUN yum install -y golang
RUN go env -w GOPROXY=direct
# cache dependencies
ADD go.mod go.sum ./
RUN go mod download
# build
ADD . .
RUN go build -o /main lambda/purge/main.go

Keybase proof

I hereby claim:

  • I am imjma on github.
  • I am iamj (https://keybase.io/iamj) on keybase.
  • I have a public key ASBOjhiY4bsd0nXS8QRTMWkGavXupnc3kBh81fBxutzibgo

To claim this, I am signing this object:

# initialization file (not found)
@imjma
imjma / gpg-import-and-export-instructions.md
Created January 11, 2017 03:16 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/

or, instead of backing up trustdb...

@imjma
imjma / .bash_aliases
Created July 29, 2015 00:51
for ubuntu
__git_complete_file=/usr/share/bash-completion/completions/git
if [ -f __git_complete_file ]; then
source __git_complete_file
fi
unset __git_complete_file
alias g='git'
alias gb='git branch'
@imjma
imjma / init.lua
Created May 1, 2015 06:19
move mouse to centre of next monitor by hammerspoon
-- Move Mouse to center of next Monitor
hs.hotkey.bind(hyper, '`', function()
local screen = hs.mouse.getCurrentScreen()
local nextScreen = screen:next()
local rect = nextScreen:fullFrame()
local center = hs.geometry.rectMidPoint(rect)
-- hs.mouse.setRelativePosition(center, nextScreen)
hs.mouse.setAbsolutePosition(center)
end)
@imjma
imjma / code.gs
Created December 5, 2013 03:32
Google Scripts for Gmail to archive inbox emails and delete old emails
function archiveInbox() {
var batchSize = 100; // Process up to 100 threads at once
// Every thread in your Inbox that is older than two days.
var threads = GmailApp.search('in:inbox older_than:5d');
for (var i = 0; i < threads.length; i+=batchSize) {
GmailApp.moveThreadsToArchive(threads.slice(i, i+batchSize));
}
}
function cleanUp() {
@imjma
imjma / private.xml
Last active December 26, 2015 18:29
/Users/[user]/Library/Application Support/KeyRemap4MacBook
<?xml version="1.0"?>
<root>
<item>
<name>F19 to F19</name>
<appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, F19)</appendix>
<identifier>private.f192f19</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::COMMAND_L,
@imjma
imjma / .bash_profile
Created March 26, 2013 06:02
~/.bash_profile
source ~/.git-completion.bash
############################################
# Modified from
# https://gist.github.com/1844923
# http://blog.superuser.com/2011/09/21/customizing-your-bash-command-prompt/
# from https://github.com/emilis/emilis-config/blob/master/.bash_ps1
#
# Modified for Mac OS X by
# @kenziii
@imjma
imjma / string-to-big-number.sh
Created August 15, 2012 04:09
string to big number
#! /bin/sh
#函数作用
#把一个任意长度的字符串转化为一个大整数,字符串从左到右权值变小
#可以给一个邮件地址作为参数,然后得到一个大整数
#然后可以用dc命令从整数得到电子邮件地址
#dc -e xxxxxP
#xxxxx为运行程序结束时得到的一个长整数
#P为dc中的输出命令