Skip to content

Instantly share code, notes, and snippets.

View vagra's full-sized avatar

Yan Chen vagra

  • CHINA
  • 23:25 (UTC +08:00)
View GitHub Profile
@mkmik
mkmik / demo
Created June 10, 2011 21:31
go md5/sha1 example
$ for a in md5 sha1 ; do ./hash -$a /bin/ls; ${a}sum /bin/ls; echo; done
a3f812b9fe329322a3d6b00722694e84 /bin/ls
a3f812b9fe329322a3d6b00722694e84 /bin/ls
9eb997f16adb828cd0273f24b0ae94d32c5a3b3f /bin/ls
9eb997f16adb828cd0273f24b0ae94d32c5a3b3f /bin/ls
@willurd
willurd / web-servers.md
Last active November 13, 2024 13:44
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@slayer
slayer / cloudflare-delete-all-records.sh
Last active September 19, 2024 10:48
Delete all DNS records for specified zone
#!/bin/bash
TOKEN="xxxxxxxxxxxxxxxxxxx"
ZONE_ID=2222222222222222222222222
# [email protected]
# KEY=11111111111111111111111111
# Replace with
# -H "X-Auth-Email: ${EMAIL}" \
# -H "X-Auth-Key: ${KEY}" \
@vheidari
vheidari / msys2-set-prroxy.txt
Last active October 23, 2024 06:35
MSYS2 - How to set proxy settings in msys2
# Add below lines to the profile in : /etc/profile
# Proxy Setting
export HTTP_PROXY="IpAddress:Port" # Like: 127.0.0.1:1477
export HTTPS_PROXY=$HTTP_PROXY
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTP_PROXY
@vagra
vagra / db.ts
Last active July 26, 2024 12:04
To replace vercel/postgres from the official Next.js tutorial with a local PostgreSQL setup, you simply need to add this /lib/db.ts file, and then change the imports in /lib/data.ts and /seed/router.ts from vercel/postgres to ./db or ../lib/db. Also, don’t forget to run npm install pg.
// db.ts
import { Pool, PoolClient } from 'pg';
import dotenv from 'dotenv';
dotenv.config();
const pool = new Pool({
connectionString: process.env.POSTGRES_URL,
});