Skip to content

Instantly share code, notes, and snippets.

View cyyeh's full-sized avatar
🎯
Focusing

Chih-Yu Yeh cyyeh

🎯
Focusing
View GitHub Profile
@dahlia
dahlia / lisp.rb
Created September 2, 2010 07:52
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,

開源之道

Original transcript: http://allisonrandal.com/2012/04/15/open-source-enlightenment/

這幾年來,我慢慢覺得,我們參與開源社群,就像是在一條道路上並肩而行:這不僅讓我們成為更好的程式設計者,也讓我們通過與人合作,而成為更好的人。

您可以將它想成一條修行之道,讓身而為人的我們能夠不斷成長。接下來,我想談談我對開源世界的個人觀點,希望能與您分享。

首先,人是一切開源專案的核心。程式碼是很重要,但最核心的永遠是人。

@sloria
sloria / bobp-python.md
Last active November 14, 2024 15:01
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@staltz
staltz / introrx.md
Last active November 19, 2024 13:42
The introduction to Reactive Programming you've been missing
@0x4D31
0x4D31 / beautiful_idiomatic_python.md
Last active September 5, 2024 12:30 — forked from JeffPaine/beautiful_idiomatic_python.md
[Beautiful Idiomatic Python] Transforming Code into Beautiful, Idiomatic Python #python

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@kayush2O6
kayush2O6 / steps_cudf.txt
Last active July 20, 2022 14:18
rapids'cudf on google colab
Steps 1: Just to verify that you have all requirement satisfied, needed by rapids.
* check the gpu card (>=Pascal arch)
!nvidia-smi
* check cuda version installed (>=9.2)
!nvcc -V
*check the python and pip version (python==3.6)
!python -V; pip -V
@kayush2O6
kayush2O6 / steps_cuml.txt
Last active May 10, 2021 06:21
rapids'cuml on google colab
BEFORE INSTALLING THE CUML, PLEASE MAKE SURE YOU HAVE FOLLOWED THE ABOVE STEPS FOR CUDF. CUDF SHOULD BE WORKING...
Step 1: Install the cuml and its depandencies.
!apt install libopenblas-base libomp-dev
!pip install cuml-cuda100
# import cuml at this point, will give libcuml.so not found error. #
NOTE: Step2 is optional and is just for information, you can fast forward to Step3 directly to work quickely.
@dunnousername
dunnousername / schemachecker.py
Created November 20, 2019 21:38
schema.org checker I made in like 5 minutes. Useful for scraping for pages that support schema.org.
#!/usr/bin/python3
# usage: schemachecker.py urls...
# requires: python 3, beautiful soup 4, requests library
from bs4 import BeautifulSoup
import requests
import sys
def checkUrl(url):
r = requests.get(url, headers={'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:10.0) Gecko/20100101 Firefox/10.0'})

Pod watcher

K8s has metrics server to provide cpu and memory usage of pods. Default 60 seconds, can be changed using --metric-resolution flag. Official are not recommending setting values below 15s, as this is the resolution of metrics calculated by Kubelet.(ref1, ref2)

So I create this tool to watch cpu and memory and log peak usage of pods.

How to install

// instal node 17
bash &lt;(curl -sL https://gist.githubusercontent.com/grieve54706/acd9c1a411adab38c4f61f2b1497769f/raw/d42e76f3f8a3aaadf3055094df8c7dab3c688e2f/upgrade-node.sh)