Skip to content

Instantly share code, notes, and snippets.

View wooramel's full-sized avatar
🎯
Focusing

Wooramel River wooramel

🎯
Focusing
View GitHub Profile
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.Base64;
/**
* 简单的 AES 对称加密
*
import requests
import sys
import os
import json
MAX_PAGE = 10
if __name__ == "__main__":
'''https://<your_gitlab_site_address>/profile/personal_access_tokens'''
@wooramel
wooramel / pidfile_snippet.go
Created April 18, 2019 01:49 — forked from davidnewhall/pidfile_snippet.go
How to write a PID file in Golang.
// Write a pid file, but first make sure it doesn't exist with a running pid.
func writePidFile(pidFile string) error {
// Read in the pid file as a slice of bytes.
if piddata, err := ioutil.ReadFile(pidFile); err == nil {
// Convert the file contents to an integer.
if pid, err := strconv.Atoi(string(piddata)); err == nil {
// Look for the pid in the process list.
if process, err := os.FindProcess(pid); err == nil {
// Send the process a signal zero kill.
if err := process.Signal(syscall.Signal(0)); err == nil {
package main
import (
"fmt"
"log"
"net"
)
func main() {
addrs, err := net.InterfaceAddrs()