Skip to content

Instantly share code, notes, and snippets.

View dexhunter's full-sized avatar
💭
I may be slow to respond.

Dixing (Dex) Xu dexhunter

💭
I may be slow to respond.
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 27, 2024 09:43
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@glueckpress
glueckpress / px-rem-cheat-sheet.css
Created May 26, 2013 16:17
Cheat sheet for rem-calculations based upon 14px and 16px.
/*! = $rembase: 14px
--------------------------------------------------------------
* hmtl { font-size: 87.5%; }
* body { font-size: 14px; font-size: 1rem; line-height: 1; }
* 4px 0.28571429rem
* 8px 0.571428571rem
* 12px 0.857142857rem
* 13px 0.928571429rem
* 14px 1rem
* 16px 1.142857143rem
@adamjohnson
adamjohnson / publickey-git-error.markdown
Last active May 27, 2024 18:08
Fix "Permission denied (publickey)" error when pushing with Git

"Help, I keep getting a 'Permission Denied (publickey)' error when I push!"

This means, on your local machine, you haven't made any SSH keys. Not to worry. Here's how to fix:

  1. Open git bash (Use the Windows search. To find it, type "git bash") or the Mac Terminal. Pro Tip: You can use any *nix based command prompt (but not the default Windows Command Prompt!)
  2. Type cd ~/.ssh. This will take you to the root directory for Git (Likely C:\Users\[YOUR-USER-NAME]\.ssh\ on Windows)
  3. Within the .ssh folder, there should be these two files: id_rsa and id_rsa.pub. These are the files that tell your computer how to communicate with GitHub, BitBucket, or any other Git based service. Type ls to see a directory listing. If those two files don't show up, proceed to the next step. NOTE: Your SSH keys must be named id_rsa and id_rsa.pub in order for Git, GitHub, and BitBucket to recognize them by default.
  4. To create the SSH keys, type ssh-keygen -t rsa -C "your_email@example.com". Th
@wen-long
wen-long / ss-redir 透明代理.md
Last active March 18, 2024 12:13
ss-redir 透明代理.md

##ss-redir 的 iptables 配置(透明代理)

透明代理指对客户端透明,客户端不需要进行任何设置就使用了网管设置的代理规则

创建 /etc/ss-redir.json 本地监听 7777 运行ss-redir -v -c /etc/ss-redir.json

iptables -t nat -N SHADOWSOCKS
# 在 nat 表中创建新链
iptables -t nat -A SHADOWSOCKS -p tcp --dport 23596 -j RETURN
# 23596 是 ss 代理服务器的端口,即远程 shadowsocks 服务器提供服务的端口,如果你有多个 ip 可用,但端口一致,就设置这个
@staltz
staltz / introrx.md
Last active May 27, 2024 03:11
The introduction to Reactive Programming you've been missing
@thaenor
thaenor / rain.cpp
Created January 10, 2015 14:14
openGL particle rain snow and hail effects
// May Ang
// mang@ucsc.edu
// CS 161 - Animation & Visualization
// Final Project - Rain/Hail/Snow Simulation
//source: https://classes.soe.ucsc.edu/cmps161/Winter09/projects/mang/finalproject.html
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
@alfredopalhares
alfredopalhares / gist:d475257c84410c7fcca6
Last active February 15, 2024 12:15
Restoring a PDF file from chrome cache

So I was trying to do my duties as a good civilian by paying taxes of stuff you already own.

In this particular case it meant going to the website and try and generate a PDF document that would allow me to pay for said stuff. After 2 unsuccessful attempts to generate the PDF (got greeted by 500s), I finally got the PDF open on chromium (using the PDF preview) and trying to save, the browser crashed..

I then quickly reboot chromium and tried to generate the PDF again, only to find out that I can't, the website only allows you to generate the document and download once, this is a critical document used as prof and means to pay your taxes. It doesn't really make much sense that you only can download it once, but such is the way of life.

I've been suffering from this bug for quite a while, but it never affected me in this way.

The file wasn't on ~/Downloads, so I've tried browsing chrome://cache and after a while I found the PDF HTTP request, w

@larryli
larryli / install-shadowsocks-local-service.sh
Last active September 7, 2020 05:57
Debian/Ubuntu systemd shadowsocks-local service
#!/bin/sh
# sudo ./install-shadowsocks-local-service.sh
cp shadowsocks-local.default /etc/default/shadowsocks-local
cp shadowsocks-local.init /etc/init.d/shadowsocks-local
chmod +x /etc/init.d/shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc0.d/K01shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc1.d/K01shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc2.d/K01shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc3.d/K01shadowsocks-local
@karpathy
karpathy / min-char-rnn.py
Last active May 27, 2024 03:04
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@ericjang
ericjang / TensorFlow_Windows.md
Last active March 27, 2021 22:19
Setting up TensorFlow on Windows using Docker.

TensorFlow development environment on Windows using Docker

Here are instructions to set up TensorFlow dev environment on Docker if you are running Windows, and configure it so that you can access Jupyter Notebook from within the VM + edit files in your text editor of choice on your Windows machine.

Installation

First, install https://www.docker.com/docker-toolbox

Since this is Windows, creating the Docker group "docker" is not necessary.