Skip to content

Instantly share code, notes, and snippets.

View tyrchen's full-sized avatar

Tyr Chen tyrchen

View GitHub Profile
@tyrchen
tyrchen / Rust vs. Swift.md
Created June 26, 2021 20:44 — forked from GeorgeLyon/Rust vs. Swift.md
A list of advantages Swift has over Rust

Note This is a little out of date. Rust has made some progress on some points, however many points still apply.

Philosophy

Progressive disclosure

Swift shares Rust's enthusiasm for zero-cost abstractions, but also emphasizes progressive disclosure. Progressive disclosure requires that language features should be added in a way that doesn't complicate the rest of the language. This means that Swift aims to be simple for simple tasks, and only as complex as needed for complex tasks.

The compiler works for you

[{"title":"Joe","image":"http://images.adrise.tv/JkC_Cw7UD2jcJtmg7dAAArPGXiE=/214x306/smart/img.adrise.tv/d57031bb-61c9-499e-bb7a-4461e76db235.jpg","id":"369854"},{"title":"Man On A Ledge","image":"http://images.adrise.tv/q4v7JUQPPHqn8nTmYiudW6l8w_0=/214x306/smart/img.adrise.tv/1c31dfce-5338-4a09-bcb0-f68789153f33.png","id":"302437"},{"title":"The Hunted","image":"http://images.adrise.tv/0K0omTIr4w7jyjK5I18cvW5ljWg=/214x306/smart/img.adrise.tv/c79d639a-de5f-44d4-86d9-40e5a892551e.png","id":"307852"},{"title":"Igor","image":"http://images.adrise.tv/mLPoP2m45bK3Rpa92yXQL6anRf8=/214x306/smart/img.adrise.tv/a04564c2-ddd7-4d3a-bcb5-8b1b07317683.jpg","id":"334155"},{"title":"Teeth","image":"http://images.adrise.tv/WMI7_mLShEgyngHjnrk2rGZWGnw=/214x306/smart/img.adrise.tv/ac8b5a44-072f-4eca-b9d5-ad708c43b880.jpg","id":"376133"},{"title":"The Town That Dreaded Sundown","image":"http://images.adrise.tv/vzLhWbZFqKMNZRK6mKRxSUSwUNg=/0x0:800x1143/214x306/smart/img.adrise.tv/d177a000-89bc-4ebc-9d90-e401c37f1161.jpg","id":"
{
"genesis_time": "2018-11-05T19:22:08.938749Z",
"chain_id": "final-chapter",
"consensus_params": {
"block_size": {
"max_bytes": "22020096",
"max_gas": "-1"
},
"evidence": {
"max_age": "100000"
# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
##### main base config options #####
# TCP or UNIX socket address of the ABCI application,
# or the name of an ABCI application compiled in with the Tendermint binary
proxy_app = "tcp://127.0.0.1:26658"
# A custom human readable name for this node

Keybase proof

I hereby claim:

  • I am tyrchen on github.
  • I am tchen (https://keybase.io/tchen) on keybase.
  • I have a public key ASAtNypwUxDdzBSoAFKJU6Gwr0F80PyExCQfA2eKWjiWJQo

To claim this, I am signing this object:

@tyrchen
tyrchen / encoding-video.md
Created December 12, 2016 15:50 — forked from Vestride/encoding-video.md
Encoding Video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aacc --with-opus
@tyrchen
tyrchen / latency.txt
Created January 14, 2016 14:29 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@tyrchen
tyrchen / nginx.conf
Created December 29, 2015 05:06 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;
@tyrchen
tyrchen / index.js
Created October 26, 2015 14:43 — forked from jeka-kiselyov/index.js
CloudWatch to AWS Lambda to Slack Channel Alerts and Charts. Posts CloudWatch Alerts via SNS topic via Lambda function to Slack channel. And draws charts for CPUUtilization metrics(both for EC2 abd RDS).
////// Save as index.js and upload it to Lambda as zip archive with node_modules directory. After:
////// npm install aws-cloudwatch-chart
////// npm install request
////// no need to upload aws-sdk module
////// Don't forget to change API keys here.
////// License: MIT
////// Docs:
@tyrchen
tyrchen / Functor.js
Created September 30, 2015 16:48 — forked from CrossEye/Functor.js
First Functor Fantasy
(function(global) {
var types = function(obj) {
throw new TypeError("fmap called on unregistered type: " + obj);
};
// inefficient as hell, but as long as there aren't too many types....
global.Functor = function(type, defs) {
var oldTypes = types;
types = function(obj) {
if (type.prototype.isPrototypeOf(obj)) {