Skip to content

Instantly share code, notes, and snippets.

@ybj14
ybj14 / jvp.py
Last active November 20, 2022 06:51
JVP
# Refer to `https://j-towns.github.io/2017/06/12/A-new-trick.html` for math details.
import torch
from torch import nn
from torch import autograd
def get_jvp(net, x, v):
'''
Generate jacobian vector product. Requires x.requires_grad()
and v.requires_grad().
Args:
@hwchong
hwchong / gist:8738e100ec4e140bae2cac2894c29d65
Created November 11, 2017 10:53
Asus Z370-I Linux Kernel Bluetooth Patch
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index e331e212f5fc..ab01f191bce8 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -366,6 +366,9 @@ static const struct usb_device_id blacklist_table[] = {
{ USB_DEVICE(0x13d3, 0x3461), .driver_info = BTUSB_REALTEK },
{ USB_DEVICE(0x13d3, 0x3462), .driver_info = BTUSB_REALTEK },
+ /* Additional Realtek 8822BE Bluetooth devices */
+ { USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK },
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active April 30, 2024 12:39
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@jason5ng32
jason5ng32 / surge.conf
Last active April 7, 2024 13:04
Surge Configs ( for 2.x )
[General]
loglevel = notify
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local, ::ffff:0:0:0:0/1, ::ffff:128:0:0:0/1
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
# dns-server = 119.29.29.29,223.5.5.5,114.114.115.115
# external-controller-access = PASSWORD@0.0.0.0:6155
# ipv6 = true
// REMEMBER TO CHANGE THE external-controller-access' PASSWORD
@dwilkie
dwilkie / ubuntu_unattended_upgrades_gmail.markdown
Created July 2, 2015 10:28
Setup unattended upgrades on Ubuntu with Gmail

Install the unattended-upgrades package

$ sudo apt-get install unattended-upgrades 

Edit the periodic configuration

$ sudo nano /etc/apt/apt.conf.d/10periodic
@ymjing
ymjing / Monaco for Powerline.md
Last active March 24, 2022 14:34
Powerline-patched Monaco for Windows and OSX

Powerline-patched Monaco for Windows and OSX

This font is manually patched with Fontforge. It includes the glyphs from DejaVu Sans Mono for Powerline.

I recommend DirectWrite-patched VIM builds. I'm using KaoriYa's build (http://www.kaoriya.net/software/vim/)

Usage

Add the following lines to your .vimrc/_vimrc:

@nomicode
nomicode / export_chat.py
Last active October 31, 2018 19:06
Export chat logs from Messages.app
#!/usr/bin/env python
import sys
import urllib
import urlparse
import base64
import mimetypes
import cgi
from os import path
@vetch
vetch / dlmusic
Last active September 2, 2016 00:58
download 320kbps music from xiami.com
#!/usr/bin/env python
#-*-coding:utf8-*-
"""
vesion2.0
这个脚本的作用是通过输入某首歌页面的url,来实现这首歌的下载,保存到当前工作目录下。
目前可以实现高音质音乐的下载,无须账号登陆。
比如,When I'm Sixty-Four的页面的url是 http://www.xiami.com/song/1003908
download_hq_music('http://www.xiami.com/song/1003908'),将会实现When I'm Sixty-Four的320k版本下载
@ccbikai
ccbikai / xiami.py
Created April 3, 2014 10:59
利用SAE获得虾米音乐外链
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import os
import sae
import web
import json
import urllib2
urls=('/','Index','/xiami/(.+)','Xiami')
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 3, 2024 12:59
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k