Skip to content

Instantly share code, notes, and snippets.

@tanyuan
tanyuan / iterm2.md
Last active January 23, 2024 17:41
📺 iTerm2 tips & tricks

iTerm2 (The awesome terminal for Mac)

Look and feel

  • Window theme: Preferences > Appearance Tab > Theme > Light/Dark
  • Show folder icon on window title: Preferences > Appearance Tab > Window: Show proxy icon in window title bar
  • Background transparancy and blur: Preferences > Profiles Tab > Window Tab > Transparency (a third) & Blur (Checked, full)
  • Color theme: Preferences > Profiles Tab > Colors Tab > Color Presets...

Window and tab title

@tanyuan
tanyuan / python_args.py
Created January 7, 2018 18:36
Python args template: read shell arguments
import argparse
if __name__ == '__main__' :
parser = argparse.ArgumentParser(description='Program description')
parser.add_argument('input', help='Input file')
parser.add_argument('-o', '--option', type=int, help='Integer option')
args = parser.parse_args()
@tanyuan
tanyuan / makefile_simple
Created January 7, 2018 18:35
Makefile template (simple)
CXX=g++
CFLAGS=-g -Wall
INCLUDE=
LINK=
all: program
%: %.cpp
$(CXX) $(CFLAGS) $(INCLUDE) $< -o $@ $(LINK)
@tanyuan
tanyuan / makefile
Created January 7, 2018 18:34
Makefile template
CC = g++
CFLAGS = -c
C11 = -std=c++11
DBGFLAGS = -g
# include OpenGL/freeglut
INC = -lGL -lGLU -lglut
all:3dmm_hw1
@echo -n ""
@tanyuan
tanyuan / unity-zip.sh
Created December 19, 2017 16:35
Zip only needed files for Unity projects.
zip -r project.zip Assets/ ProjectSettings/
@tanyuan
tanyuan / userChrome.css
Last active November 19, 2018 10:04
🦊 Firefox macOS: Tabs on Bottom & Tab Close Button on Left
/* Firefox userChrome.css for Mac
1) Tabs on Bottom
2) Tab Close Button on Left
*/
/* Tabs on Bottom */
/* -------------------------------- */
#TabsToolbar {
-moz-box-ordinal-group: 2;
}
@tanyuan
tanyuan / rm-ds.sh
Created September 9, 2017 07:57
Mac: Remove .DS_Store under current directory recursively.
find . -name .DS_Store -type f -delete
@tanyuan
tanyuan / show-readme.py
Created July 6, 2017 19:25
Nautilus Python extension to show first line of README file under current directory.
from gi.repository import Gtk, Nautilus, GObject
import urllib, urlparse
class LocationProviderExample(GObject.GObject, Nautilus.LocationWidgetProvider):
def __init__(self):
pass
def get_widget(self, uri, window):
path = urllib.url2pathname(urlparse.urlparse(uri).path)
with open(path+'/README', 'r') as f:
@tanyuan
tanyuan / location-widget-provider.py
Created July 6, 2017 19:21
GNOME Files (Nautilus) Python extension simple info bar example. Put in ~/.local/share/nautilus-python/extensions/
from gi.repository import Gtk, Nautilus, GObject
class LocationProviderExample(GObject.GObject, Nautilus.LocationWidgetProvider):
def __init__(self):
pass
def get_widget(self, uri, window):
vb = Gtk.VBox()
bar = Gtk.InfoBar()
vb.pack_start(bar, False, False, 0)
@tanyuan
tanyuan / gyroRotate.cs
Created June 4, 2017 12:01
Simple 360 scene using Cardboard via Unity Remote
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class gyroRotate : MonoBehaviour {
void Start () {
}
void FixedUpdate () {
Input.gyro.enabled = true;