Skip to content

Instantly share code, notes, and snippets.

Helin Wang helinwang

  • Bay Area
Block or report user

Report or block helinwang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@helinwang
helinwang / mac_malware_auto_start.txt
Last active Apr 18, 2019
Places that mac malware could hide (auto start)
View mac_malware_auto_start.txt
/Library/StartUpItems
/Library/LaunchAgents
/Library/LaunchDaemons
/System/Library/LaunchDaemons
/System/Library/LaunchAgents
/Users/$USER/Library/LaunchAgents
/Library/PrivilegedHelperTools
and "system preferences" -> login items
"keychain access": unkown certificates (except the ones in "System Roots")
@helinwang
helinwang / init.el
Created Mar 30, 2019
My Rust emacs configuration
View init.el
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(when no-ssl
(warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
@helinwang
helinwang / click.js
Created Jan 4, 2019
Batch delete Weibo posts
View click.js
setInterval(() => {
document.querySelector('a[action-type="feed_list_delete"]').click()
document.querySelector('a[action-type="ok"]').click()
}, 500)
@helinwang
helinwang / upload.py
Last active Dec 18, 2018
Upload large file to dropbox using Python
View upload.py
import sys
import dropbox
path = sys.argv[1]
dbx = dropbox.Dropbox(AUTH_TOKEN, timeout=6000) # set the timeout best for you
with open(path, 'rb') as f:
data = f.read()
dbx.files_upload(
data, DROPBOX_FOLDER_NAME, dropbox.files.WriteMode.overwrite,
mute=True)
@helinwang
helinwang / unraid_mount.md
Last active Aug 31, 2019
Unraid: mount a unraid share using the unraid mount tag in Ubuntu
View unraid_mount.md

Mounting the shared path You can mount the shared folder using

mount -t 9p -o trans=virtio [mount tag] [mount point] -oversion=9p2000.L

mount tag: As specified in Qemu commandline. mount point: Path to mount point. trans: Transport method (here virtio for using 9P over virtio) version: Protocol version. By default it is 9p2000.u . Other options that can be used include:

@helinwang
helinwang / heap.go
Created Jul 19, 2018
a heap implementation in Go
View heap.go
package types
// Heap is a max heap
type Heap struct {
buf []int
}
func (h *Heap) Peak() int {
return h.buf[0]
}
@helinwang
helinwang / queue.go
Last active Jul 21, 2018
Simple queue implementation
View queue.go
package types
// Note: this queue does not shrink the underlying buffer.
type queue struct {
buf [][4]int // change to the element data type that you need
head int
tail int
}
func (q *queue) extend(need int) {
@helinwang
helinwang / log15.diff
Last active Mar 11, 2018
Improve golang log15 library
View log15.diff
diff --git a/format.go b/format.go
index bce4914..fb40b9d 100644
--- a/format.go
+++ b/format.go
@@ -12,8 +12,8 @@ import (
)
const (
- timeFormat = "2006-01-02T15:04:05-0700"
- termTimeFormat = "01-02|15:04:05"
@helinwang
helinwang / .travis.yml
Created Mar 2, 2018
PaddlePaddle EDL .travis.yml file
View .travis.yml
matrix:
include:
- language: go
go: 1.8.x
sudo: required
install:
- go get -u github.com/golang/lint/golint
- curl https://glide.sh/get | bash
- sudo pip install pre-commit
script:
@helinwang
helinwang / .pre-commit-config.yaml
Created Mar 2, 2018
PaddlePaddle EDL .pre-commit-config.yaml
View .pre-commit-config.yaml
- repo: https://github.com/dnephin/pre-commit-golang
sha: e4693a4c282b4fc878eda172a929f7a6508e7d16
hooks:
- id: go-fmt
files: \.go$
- id: go-lint
files: \.go$
exclude: (.*\/client\/.*\.go|.*\generated\.deepcopy\.go)$
- repo: local
You can’t perform that action at this time.