Skip to content

Instantly share code, notes, and snippets.

@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;
@tanyuan
tanyuan / inject-360-exif.sh
Last active June 22, 2017 14:06
Make Facebook / Google Photos recognize 360 photo
convert photo.png photo.jpg
# Facebook
exiftool -ProjectionType="equirectangular" photo.jpg
# Google Photos
exiftool -ProjectionType="equirectangular" -UsePanoramaViewer="True" -"PoseHeadingDegrees<$exif:GPSImgDirection" -"CroppedAreaImageWidthPixels<$ImageWidth" -"CroppedAreaImageHeightPixels<$ImageHeight" -"FullPanoWidthPixels<$ImageWidth" -"FullPanoHeightPixels<$ImageHeight" -CroppedAreaLeftPixels="0" -CroppedAreaTopPixels="0" photo.jpg
@tanyuan
tanyuan / rclone.md
Created February 13, 2017 00:43
rsync for Google Drive, Dropbox etc.

rclone

Setup

rclone config

Config file is stored at ~/.rclone.conf

List directories

@tanyuan
tanyuan / samba.md
Last active February 25, 2022 14:55
Access Arch Linux folders from Mac using samba

Access Arch Linux folders from Mac using samba

Tested with Arch Linux and macOS Sierra

First make sure that the two machines can see each other.

On Arch, find out IP of Arch Linux machine by:

ip addr