Skip to content

Instantly share code, notes, and snippets.

View newnewcoder's full-sized avatar
🐌
On vacation

newnewcoder newnewcoder

🐌
On vacation
  • Taiwan Taipei
View GitHub Profile
@lunaspeed
lunaspeed / csrf.go
Created May 29, 2020 02:03
Ruby CSRF token generation and verification in Golang
package csrf
import(
"encoding/base64"
"encoding/hex"
"fmt"
"github.com/theckman/go-securerandom"
)
const AuthenticityTokenLength = 32
@danny0838
danny0838 / .gitconfig
Last active June 23, 2020 22:57
實用的 Git 配置值
[core]
quotepath = false # 中文檔名如實顯示而不轉碼
autocrlf = false # commit 及 checkout 時不根據作業系統轉換檔案的換行字元 (避免不小心改動原 repo 的換行字元)
safecrlf = false # 檢查文字類檔案是否混合了 CRLF 及 LF 換行字元 (搭配 autocrlf,這裡一起關閉)
ignorecase = false # 檔名大小寫不同時視為相異 (更動大小寫才能 commit)
whitespace = cr-at-eol # diff 時行尾 CRLF 不顯示 ^M
fileMode = false # 忽略檔案的 x 屬性 (for Windows)
symlinks = false # 忽略符號連結 (for Windows)
editor = /usr/bin/vim # 預設的文字編輯器 (for Linux)
[alias]
@lunaspeed
lunaspeed / gist:e87b3e24ac9e6a231cc0757003f87b14
Last active January 8, 2018 03:45
快快樂樂裝docker
sudo curl -sSL https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
sudo curl -L "https://github.com/docker/compose/releases/download/1.16.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo apt-get install -y bash-completion
object LocalDateTimeUtils {
//Calendar to LocalDate
@JvmStatic
fun toLocalDate(calendar: Calendar): LocalDate {
return LocalDate.of(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH))
}
//Date to LocalDate
@JvmStatic
@cs8425
cs8425 / README.md
Last active February 26, 2025 11:42
How to REAL install Remix OS on VirtualBox

How to REAL install Remix OS on VirtualBox

This is how to REAL install Remix OS on VirtualBox. rootfs could be writable!!!

Needs:

  • any linux liveCD iso file (Xubuntu here)
  • Remix OS iso file ("Remix_OS_for_PC_Android_M_32bit_B2016092201.iso" here)
  • VirtualBox
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active June 30, 2025 12:55
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@JustinSDK
JustinSDK / producer_consumer.py
Created July 26, 2016 02:36
producer_consumer
import sys
import random
def producer():
while True:
data = random.randint(0, 9)
print('生產了:', data)
yield data
def consumer():
@daicham
daicham / .gitlab-ci.yml
Last active November 13, 2024 07:47
A sample of .gitlab-ci.yml for a gradle project
image: java:8-jdk
stages:
- build
- test
- deploy
before_script:
# - echo `pwd` # debug
# - echo "$CI_BUILD_NAME, $CI_BUILD_REF_NAME $CI_BUILD_STAGE" # debug
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active June 18, 2025 07:17
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE