Skip to content

Instantly share code, notes, and snippets.

View ysl2's full-sized avatar
🐧
Working

Silas Yu ysl2

🐧
Working
View GitHub Profile
@ryin
ryin / tmux_local_install.sh
Last active July 13, 2024 00:42
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
#!/bin/bash -e
#-------------------------------------------------------------------------------
# Default values
#-------------------------------------------------------------------------------
: ${AUTOCONF_VERSION:=$1}
echo "[INFO] Autoconf '$AUTOCONF_VERSION'"
: ${GCC_HOME:=}
@ctokheim
ctokheim / cython_tricks.md
Last active March 4, 2024 23:27
cython tricks

Cython

Cython has two major benefits:

  1. Making python code faster, particularly things that can't be done in scipy/numpy
  2. Wrapping/interfacing with C/C++ code

Cython gains most of it's benefit from statically typing arguments. However, statically typing is not required, in fact, regular python code is valid cython (but don't expect much of a speed up). By incrementally adding more type information, the code can speed up by several factors. This gist just provides a very basic usage of cython.

@tuxfight3r
tuxfight3r / 01.bash_shortcuts_v2.md
Last active July 25, 2024 08:41
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@jgrar
jgrar / dwm-3465bed290ab-save_floats.diff
Created December 31, 2015 02:55
Add save float behaviour to all layout changes
diff --git a/dwm.c b/dwm.c
index 450e420..7978a1f 100644
--- a/dwm.c
+++ b/dwm.c
@@ -89,6 +89,7 @@ struct Client {
char name[256];
float mina, maxa;
int x, y, w, h;
+ int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
int oldx, oldy, oldw, oldh;
@saitoha
saitoha / suckless-st-sixel.diff
Last active June 15, 2024 15:52
Add SIXEL graphics support for suckless st. (sixel.c/sixel_hls.c come from mintty, licensed under GPL)
commit ea830e03d4d4562b1ff225940f65bceddd9cad6c
Author: Hayaki Saito <saitoha@me.com>
Date: Sun Jun 11 23:46:45 2017 +0900
Add sixel graphics support
Signed-off-by: Hayaki Saito <saitoha@me.com>
diff --git a/Makefile b/Makefile
index d8595fe..a25d040 100644
Basic
=====
[Shift]+[Mod]+[Enter] - launch terminal.
[Mod]+[b] - show/hide bar.
[Mod]+[p] - dmenu for running programs like the x-www-browser.
[Mod]+[Enter] - push acive window from stack to master, or pulls last used window from stack onto master.
[Mod] + [j / k] - focus on next/previous window in current tag.
import sys
class Tee(object):
def __init__(file_name, mode):
self._file = open(file_name, mode)
def __enter__(self):
return self
def __exit__(self):
self.__close()
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active July 25, 2024 14:11
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized
@Hammer2900
Hammer2900 / square_window.py
Created July 24, 2019 05:09
i3 control window position
import i3ipc
i3 = i3ipc.Connection()
def center_window():
"""
Float and center window, i3wm.
:return:
"""