Skip to content

Instantly share code, notes, and snippets.

@entron
entron / set-apt-proxy.md
Created August 23, 2024 01:39 — forked from wonderbeyond/set-apt-proxy.md
[ubuntu][socks5][proxy] Set proxy for apt

Writing an apt proxy conf file /etc/apt/apt.conf.d/proxy.conf as below.

Acquire::http::Proxy "socks5h://127.0.0.1:1080";
Acquire::https::Proxy "socks5h://127.0.0.1:1080";
Acquire::socks::Proxy "socks5h://127.0.0.1:1080";

And the proxy settings will be applied the next time we run apt.

@entron
entron / http-proxy.conf.md
Last active August 22, 2024 13:51 — forked from alphamarket/http-proxy.conf.md
How to make docker pull using a socks5 proxy

Create the config file:

mkdir -p /etc/systemd/system/docker.service.d && \
vi /etc/systemd/system/docker.service.d/http-proxy.conf

Put up the configs:

@entron
entron / cnn_dummy_bench.ipynb
Last active June 13, 2020 16:43
simple gpu benchmark code with pytorch for common CNN netoworks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / cifar10_bench.ipynb
Last active June 13, 2020 16:42
simple gpu benchmark with pytorch
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / plot_dingxiang_data.ipynb
Last active February 11, 2020 15:08
Plotting data of 2019-nCoV outbreak. Data source: https://github.com/BlankerL/DXY-2019-nCoV-Data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@entron
entron / test_pytorch.py
Created August 14, 2017 18:44
Test pytorch linear algebra speed
import torch
import time
# --- Test 1
N = 10
n = 1000
A = torch.randn(n, n)
B = torch.randn(n, n)
@entron
entron / test_numpy.py
Last active June 7, 2020 10:12
Test numpy installation.
import numpy as np
import numpy.random as npr
import time
# --- Test 1
N = 100
n = 2000
A = npr.randn(n, n)
B = npr.randn(n, n)
@entron
entron / sqlite_online_backup.py
Created August 13, 2016 09:13
Online backup sqlite db with python
# Online backup a sqlite3 DB.
# python3 sqlite_online_backup.py db_to_backup.sqlite backup_db.sqlite
import sqlite3
import sqlitebck
import sys
fname_to_backup = sys.argv[1]
fname_backup = sys.argv[2]
@entron
entron / gist:cfb5a560f1372acb8bf7
Created February 15, 2016 14:44 — forked from wacko/gist:5577187
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

@entron
entron / imdb_cnn_kim_small_embedding.py
Last active September 16, 2023 16:23
Keras implementation of Kim's paper "Convolutional Neural Networks for Sentence Classification" with a very small embedding size. The test accuracy is 0.853.
'''This scripts implements Kim's paper "Convolutional Neural Networks for Sentence Classification"
with a very small embedding size (20) than the commonly used values (100 - 300) as it gives better
result with much less parameters.
Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python imdb_cnn.py
Get to 0.853 test accuracy after 5 epochs. 13s/epoch on Nvidia GTX980 GPU.
'''
from __future__ import print_function