Skip to content

Instantly share code, notes, and snippets.

View Ir1d's full-sized avatar
💭
Looking for internship

Dejia Xu Ir1d

💭
Looking for internship
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 1, 2024 03:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@ryin
ryin / tmux_local_install.sh
Last active April 23, 2024 01:06
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
@scraperdragon
scraperdragon / chrome2requests.py
Created August 22, 2012 11:25
Convert Chrome headers to Python's Requests dictionary
dict([[h.partition(':')[0], h.partition(':')[2]] for h in rawheaders.split('\n')])
@suziewong
suziewong / ssh.md
Last active December 31, 2021 08:16
SSH端口转发

ssh

    -C  压缩数据传输
    -f  后台登录用户名密码
    -N  不执行shell[与 -g 合用]
    -g  允许打开的端口让远程主机访问        
    -L  本地端口转发
    -R  远程端口转发

-p ssh 端口

@shunsukeaihara
shunsukeaihara / cc.py
Created January 23, 2013 08:45
some of color correction algorithm in python
# -*- coding: utf-8 -*-
import numpy as np
import Image
import sys
def from_pil(pimg):
pimg = pimg.convert(mode='RGB')
nimg = np.asarray(pimg)
nimg.flags.writeable = True
return nimg
@selfboot
selfboot / aprilFools.css
Last active December 19, 2015 03:21
win下修改chrome和360浏览器6.0版本的Custom.css,恶搞网页。 setup.py 为 py2exe的转换脚本。
/* HTML PRIDE! */
html {
-webkit-animation: rainbow 8s infinite;
}
/*
Spin all images
*/
img {
-webkit-animation: spin 1s linear infinite;
@lychees
lychees / array.cpp
Last active December 24, 2015 07:21
HDU 4010. Query on The Trees 现在的搞法。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
using namespace std;
#define REP_1(i, n) for (int i=1;i<=n;++i)
#define Rush for(int ____T=RD(); ____T--;)
/** I/O Accelerator Interface .. **/ //{
#define g (c=getchar())
@nikmartin
nikmartin / A: Secure Sessions Howto
Last active April 28, 2024 05:17
Secure sessions with Node.js, Express.js, and NginX as an SSL Proxy
Secure sessions are easy, but not very well documented.
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy:
The desired configuration for using NginX as an SSL proxy is to offload SSL processing
and to put a hardened web server in front of your Node.js application, like:
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [PUBLIC INTERNET] <-> [CLIENT]
Edit for express 4.X and >: Express no longer uses Connect as its middleware framework, it implements its own now.
@6174
6174 / Random-string
Created July 23, 2013 13:36
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@nicbell
nicbell / 1_primitive_comparison.js
Last active September 23, 2022 16:56
JavaScript object deep comparison. Comparing x === y, where x and y are values, return true or false. Comparing x === y, where x and y are objects, returns true if x and y refer to the same object. Otherwise, returns false even if the objects appear identical. Here is a solution to check if two objects are the same.
//Primitive Type Comparison
var a = 1;
var b = 1;
var c = a;
console.log(a == b); //true
console.log(a === b); //true
console.log(a == c); //true
console.log(a === c); //true