Skip to content

Instantly share code, notes, and snippets.

@nilbot
nilbot / rnn_init_utils.py
Created August 23, 2019 02:52
reset_params()
def reset_parameters(self):
"""
Properly initialize the weights, following the same recipe as:
Xavier init: http://proceedings.mlr.press/v9/glorot10a/glorot10a.pdf
Kaiming init: https://arxiv.org/abs/1502.01852
"""
# initialize weights such that E[w_ij]=0 and Var[w_ij]=1/d
d = self.weight.size(0)
val_range = (3.0/d)**0.5
self.weight.data.uniform_(-val_range, val_range)
@nilbot
nilbot / pytorch-live-ticker.md
Created May 31, 2018 15:11
some pytorch notes

On 0.4 migration, merge of V and T introducing requires_grad, affecting all optimizer

So I don't really think that it makes sense to allow such parameters. If you don't want to optimize some tensors, they're not parameters - they're fixed. You probably don't want to count them in. And if you really need to then

optimizer.SGD(filter(lambda p: p.requires_grad, model.parameters()), lr=1e-3) should do the trick.

#include <stdio.h>
#include <stdlib.h>
void printMatrix(double** m, int n) {
printf("\n\n");
int i = 0;
int j = 0;
for (i = 0; i < n; i++) {
for (j = 0; j < n - 1; j++) {

Keybase proof

I hereby claim:

  • I am nilbot on github.
  • I am nilbot (https://keybase.io/nilbot) on keybase.
  • I have a public key whose fingerprint is 9A69 6E88 570E EBF2 66BC EDEB 32EB 9781 97BA B360

To claim this, I am signing this object:

@nilbot
nilbot / build.err.log
Created April 27, 2016 09:27
[XiEditor - xcodebuild] build.err.log [XiEditor rev: 0c83cb6]
=== BUILD LEGACY TARGET xicore OF PROJECT XiEditor WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
ExternalBuildToolExecution xicore
cd /Users/nilbot/src/github.com/google/xi-editor/rust
export ACTION=
export ALTERNATE_GROUP=staff
export ALTERNATE_MODE=u+w,go-w,a+rX
export ALTERNATE_OWNER=nilbot
@nilbot
nilbot / 请问你们哪来的自信让别人跟你一起傻逼
Last active September 9, 2015 07:34
请问你们哪来的自信让别人跟你一起傻逼
请问你们哪来的自信让别人跟你一起傻逼 2015-09-08 王五四 钢板樱桃 范玮琪在阅兵日被人欺负时没有第一时间送上温暖。由于阅兵日在微博上晒了娃,没发“卧槽,真尼玛整齐”、“祖国我爱你”一类的,范范被一堆人逼着道歉,你们这些人真是闲得无聊,道歉有用还阅兵干嘛?你们应该呼吁军队打到台湾去活捉范玮琪。这种人的心态不难理解:一是“天朝上国”的底层小民,内心脆弱而无知,你不发照片表态就是看不起我们,我们的军队走得这么整齐你居然还敢看不起,二是我都发了你不发,就有显得我很傻逼的风险,所以你必须一起发,这样就不会显得自己那么二逼。一个人若是在阅兵日连不看阅兵的自由都没有,那么那些兵肯定不是用来保护你的。 请问你们哪来的自信让别人跟你一块傻逼,有些人平时看着挺正常,一到这些特殊时刻就显露出急性短暂性精神障碍,逼明星跟你一起发阅兵微博好歹也要找个国产明星,你找一美籍华裔算什么?记得08奥运会的时候,羽毛球男单决赛,马来西亚的李宗伟输给了中国的林丹,梁静茹哭得花枝乱颤,微博上一堆人质问:你他妈还是中国人吗!梁静茹的确不是中国人,她是马来西亚人,有些时候搞清国籍再傻逼真的很重要,这也是起码的职业素养。在一些特殊的日子里,总有人喜欢逼着我们特别是一些名人干一些特殊的事,受灾了你就要捐款,不捐不行,捐少了不行,至于捐款怎么用会不会被贪污他们一概不关心;受难了,你不能笑不能娱乐不能不点蜡烛,至于为什么会发生这场灾难,灾难里死了多少无辜者,这也不是他们关心的。这些人以前还傻得单纯,只是玩些威胁取关,不用你的产品,严重点就抵制日货一类的,现在傻得都有精神障碍了,动不动就“我军我国”的要打世界大战,这里面哪一个是你的?你以为裁军三十万能分你个文工团员?咱别动不动就抵制日货,你买得起或者买得到吗? 强制性地举国欢庆和举国悲痛,不允许他人有不同的情绪选择,这本身就是病,金日成死的时候全朝鲜都哭,不哭就是政治立场有问题,哭得不惨烈就是不热爱天降伟人,一些从
@nilbot
nilbot / README.md
Created August 4, 2015 14:47
zhujiceping.com 批量

#用法

太长了,不读

[BIN] -s [SERVER(range)] -p [PORT(range)] -c [SERVER_NAME] [-d]
  -c string
        comment for this server (group)
 -d debug
@nilbot
nilbot / test_ip_list.txt
Created June 29, 2015 04:55
chinese isp test
fifa14.service.easports.com
fifa15.service.easports.com
www.dd-wrt.com
108.61.163.235.vultr.com
www.xda-developers.com
104.224.162.217.16clouds.com
104.224.141.127.16clouds.com
104.224.145.203.16clouds.com
45.62.112.117.16clouds.com
test.nyc.ramnode.com
@nilbot
nilbot / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@nilbot
nilbot / GetExternalIP.sh
Created September 8, 2012 11:41
GEt External IP from router
#!/bin/bash
FBIP=192.168.3.1
NETCAT=`which nc`
[ -z "$NETCAT" ] && NETCAT=`which netcat`
[ -z "$NETCAT" ] && exit 1
INTERFACE_NS="urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1"