Skip to content

Instantly share code, notes, and snippets.

View fkztw's full-sized avatar
📺
Hello World!

Frank Zheng fkztw

📺
Hello World!
  • Taiwan
  • 20:10 (UTC +08:00)
View GitHub Profile
@katowulf
katowulf / print_ip_and_headers.js
Last active September 13, 2024 03:12
Print IP address and headers in Cloud Functions
const functions = require('firebase-functions');
const util = require('util');
exports.helloWorld = functions.https.onRequest((req, res) => {
// For Firebase Hosting URIs, use req.headers['fastly-client-ip']
// For callable functions, use rawRequest
// Some users have better success with req.headers['x-appengine-user-ip']
const ipAddress = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
const headers = JSON.stringify(req.headers, null, 2);
const message = util.format("<pre>Hello world!\n\nYour IP address: %s\n\nRequest headers: %s</pre>", ipAddress, headers);
@apua
apua / job_desc.rst
Last active January 4, 2018 12:29
job description

Sr. Software Engineer/Systems Software Engineer

This position is responsible for developing test automation software to validate server software and hardware functionality. Engineer will translate high-level requirements into detailed designs, and implementation, debug assortment of hardware and software test related issues as well as have the vision to develop/enhance test software as appropriate to better the quality of our industry leading ProLiant servers.

Responsibilities

  • Design, develop and deliver code that is necessary to support new feature developments and enhancements in an agile software development environment
  • Deliver unit tests and automated tests with all code to prove correctness, and robustness for high quality software delivery
@shihanng
shihanng / .chunkwmrc
Last active January 6, 2024 04:17
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#
pkgname=libva1-ubuntu
pkgver=1.7
pkgrel=1
pkgdesc="Old libva from Ubuntu 16.04 for apps not supporting libva2 (esp. Parsec.tv)"
arch=('x86_64')
url="https://linux.palemoon.org"
license=('GPL' 'BSD')
depends=()
mirror="http://archive.ubuntu.com/ubuntu"
source=(
@otiai10
otiai10 / freebsd-vagrant.md
Last active December 24, 2018 17:13
[help wanted] FreeBSD by Vagrant on macOS NOT working
@matthewdowney
matthewdowney / gen.py
Created October 13, 2017 09:42
P2WPKH-P2SH (SegWit) Wallet Address Generation
"""
Implementation of "Pay to Witness Public Key Hash nested in BIP16 Pay to Script Hash" (P2WPKH-P2SH) address generation.
Described in BIP 141 (SegWit) https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#P2WPKH_nested_in_BIP16_P2SH
I.e.: Public key -> SegWit address
"""
import hashlib
from hashlib import sha256
@uranusjr
uranusjr / better-python-env.md
Last active June 8, 2023 14:11
Toward a better Python installation

Toward a better Python installation

Meta

想要的特質

  • 不會太污染 PATH
  • 盡可能避免要求 root/admin 權限
  • 可以同時安裝多個版本(只需要到 minor,不須 patch)
  • 可以輕鬆啟動任意一個版本的 Python,不須多餘設定,版本之間也不會互相衝突

Re: asyncio 好寫嗎?

首先,其實還滿開心有機會可以做個小小辯論的啦。我的回應如下

這把好幾個主題混在一起了,需要一個一個看。

1. Async Program 好寫嗎?

不好寫。東西好不好寫的意思,代表它和 programmer 的內在思考模式符合程度。Async program 不符合人類習慣思維,所以才會被說一開始的學習 overhead 很高,寫起來容易卡。尤其如果同步與異步 paradigms 並立(例如 Python),就更容易在切換的時候出問題。

@zaiste
zaiste / rst_to_md.sh
Created February 5, 2017 18:54
Convert RST to Markdown using Pandoc
FILES=*.rst
for f in $FILES
do
filename="${f%.*}"
echo "Converting $f to $filename.md"
`pandoc $f -f rst -t markdown -o $filename.md`
done
@audreyt
audreyt / GRCA1_GRCA1_5_GCA2.crt
Last active October 23, 2021 13:48
GCA and GRCA certificate that works with Android 7.0
-----BEGIN CERTIFICATE-----
MIIGTjCCBDagAwIBAgIRALVZ5wcHJa1iYpTVEud3FVQwDQYJKoZIhvcNAQELBQAw
PzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dvdmVybm1lbnQgUm9vdCBDZXJ0aWZp
Y2F0aW9uIEF1dGhvcml0eTAeFw0xMjA5MjgwOTEzMjlaFw0zMjEyMDUxMzIzMzNa
MD8xCzAJBgNVBAYTAlRXMTAwLgYDVQQKDCdHb3Zlcm5tZW50IFJvb3QgQ2VydGlm
aWNhdGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
AQC2/5c8gb4BWCQnr44BK9ZykjAyG1+bfNTUf+ihYHMwVxAA+lCWJP5Q5ow6ldFX
eYTVZ1MMKoI+GFy4MCYa1l7GLbIEUQ7v3wxjR+vEEghRK5lxXtVpe+FdyXcdIOxW
juVhYC386RyA3/pqg7sFtR4jEpyCygrzFB0g5AaPQySZn7YKk1pzGxY5vgW28Yyl
ZJKPBeRcdvc5w88tvQ7Yy6gOMZvJRg9nU0MEj8iyyIOAX7ryD6uBNaIgIZfOD4k0