Skip to content

Instantly share code, notes, and snippets.

View jacobbubu's full-sized avatar

Rong Shen jacobbubu

  • Li Auto.
  • Beijing, China
View GitHub Profile
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@jacobbubu
jacobbubu / countries.json
Created April 9, 2015 07:13
Chinese country names and their ISO code
[
{
"ISO2": "AD",
"ISO3": "AND",
"DIGITS": "20",
"ISO-3166-2": "ISO 3166-2:AD",
"English": " Andorra",
"China": "安道尔",
"Taiwan": "安道爾",
"Hongkong": "安道爾",
@jacobbubu
jacobbubu / ISOCurrencyCodes.csv
Created February 15, 2012 14:28
iOS Currency Codes
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
ADP Andorran Peseta
AED United Arab Emirates Dirham
AFA Afghan Afghani (1927-2002)
AFN Afghan Afghani
ALK Albanian Lek (1946-1965)
ALL Albanian Lek
AMD Armenian Dram
ANG Netherlands Antillean Guilder
AOA Angolan Kwanza
AOK Angolan Kwanza (1977-1991)
@jacobbubu
jacobbubu / ISOLanguageCodes.csv
Created February 15, 2012 14:30
iOS Language Codes
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
aa Afar
ab Abkhazian
ace Achinese
ach Acoli
ada Adangme
ady Adyghe
ae Avestan
af Afrikaans
afa Afro-Asiatic Language
afh Afrihili
@jacobbubu
jacobbubu / blender-multi_gpu.markdown
Created January 7, 2017 02:53 — forked from Fweeb/blender-multi_gpu.markdown
Rendering in Blender on a machine with multiple GPUs

Rendering in Blender on a machine with multiple GPUs

So here's the premise: For scenes that take around a minute or less to render, performance is actually worse if you render on all of the cards with a single instance of Blender. This is because (AFAIK) there's a bit of additional time necessary to collect the render results from each card and stitch them together. That time is a fixed short duration, so it's negligible on larger/longer render jobs. However, on shorter render jobs, the 'stitch time' has a much more significant impact.

I ran into this with a machine I render on that has 4 Quadro K6000s in it. To render animations, I ended up writing a few little scripts to facilitate launching 4 separate instances of Blender, each one tied to one GPU. Overall rendertime was much shorter with that setup than one instance of Blender using all 4 GPUs.

The setup works basically like this. In my .blend file, I embed 4 text files, batch-render0.py, batch-render1.py, batch-render2.py, and `batch-rende

@jacobbubu
jacobbubu / 如何实现 pull-stream 的 Source.md
Last active March 7, 2023 14:31
如何实现 pull-stream 的 Source

Source(read) 概述

Sink 对 Source 有两种请求:

  1. read: 向 Source 请求数据,通过 read(null, currCb) 来请求。
  2. abort: 通知 Source 终止当前的 stream,通过 read(endOrError, currCb) 来请求。endOrError 的类型是 true | Error,表示是一次正常的终止还是异常的终止。

对于 read 请求,Sink 应该基于 上一次的 read 请求回调了,再发起新的 read 请求这样的规则。 对于 abort 请求,由于有时 Source 也不知道何时需要 abort(出现了异常或者外部其他条件触发的),因此可能在上一次 read 没有回调就发生。

  • 对于 Sink 的 read 请求,如果”重入“(上一次 read 没有结束,新的 read 来了),Source 完成实际资源的读取后,仅仅调用最后一个传入的 currCb 来传递数据。
@jacobbubu
jacobbubu / ISOCountryCodes.csv
Created February 15, 2012 14:26
iOS Country Codes
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
AD Andorra
AE United Arab Emirates
AF Afghanistan
AG Antigua and Barbuda
AI Anguilla
AL Albania
AM Armenia
AN Netherlands Antilles
AO Angola
AQ Antarctica
@jacobbubu
jacobbubu / country.json
Created May 28, 2013 12:26
Link country table from Weibo to geonames.org's data.
This file has been truncated, but you can view the full file.
[
{
"weiboCode": "005",
"name": "Argentina",
"geoNames": {
"countryId": "3865483",
"alternateNames": [
{
"name": "Argentinië",
"lang": "af"
@jacobbubu
jacobbubu / createrepo.sh
Created October 17, 2019 08:49
Create a github repo. using the name from package.json and then put the repo's url back to `package.repository`
name=`node -e "process.stdout.write((require('./package.json').name.replace(/^@[\w\d\-\_]+\//, '')))"`
if [ -z ${name+x} ]; then
echo 'No "name" field found in package.json'
else
output=`gh re --browser false --new $name`
repo=`echo $output | grep -Eo '(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'`
repo+=".git"
echo $repo | `node -e "process.stdin.resume();process.stdin.setEncoding('utf8');var gitUrl = '';process.stdin.on('data', function(chunk) { gitUrl = chunk.split('\n')[0]; });process.stdin.on('end', function() {var fs=require('fs');var pkg=require('./package.json');pkg.repository = { type: 'git', url: gitUrl };fs.writeFileSync('./package.json', JSON.stringify(pkg, null, 2), 'utf8');})"`
fi
@jacobbubu
jacobbubu / ISOCurrencySymbols.csv
Created February 15, 2012 14:31
iOS Currency Symbols
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
ADP ADP
AED AED
AFA AFA
AFN Af
ALK ALK
ALL ALL
AMD AMD
ANG NAf.
AOA Kz
AOK AOK