Skip to content

Instantly share code, notes, and snippets.

View timotheos's full-sized avatar
Brewing coffee

Timothy Pua timotheos

Brewing coffee
  • Chigasaki-Shi, Kanagawa Prefecture, Japan
View GitHub Profile

sleep 1500 && gedit -b; sleep 60 && killall gedit

sleep 1500 && notify-send break

sleep 1500 && osascript -e "display notification "Break time. Remember not to do anything related to the project and just relax" with title "Pomodoro""

@timotheos
timotheos / setup.md
Created August 11, 2017 10:54
Server Setup (credits to dayvough)

Credits to dayvough

https://gist.github.com/dayvough/ebc3a2fd7bb62cf02916827acf7c5738/

Vars

app_dir = /home/deploy/app_name
@timotheos
timotheos / nginx.conf
Created August 11, 2017 10:56
Unicorn + Rails + Nginx (credits to dayvough)
upstream app_name {
server unix:///home/deploy/app_name/shared/pids/unicorn.sock;
}
server {
listen 80;
server_name example.com;
root /home/deploy/app_name/current/public;
@timotheos
timotheos / port_selection-std.md
Last active April 16, 2018 03:48
Port selection cheatsheet
@timotheos
timotheos / ubuntuPi-setup.md
Last active May 1, 2019 20:22
Fresh Raspberry Pi setup with Ubuntu 16.04 server

Raspberry Pi ssh as access point

Still under construction

Steps

  1. Download from Official Ubuntu website or (Ubuntu Pi Flavour Maker)[https://ubuntu-pi-flavour-maker.org/download/]
  2. Flash to SD card.
  3. If downloaded from Official website, follow instructions before inserting sd card and booting.
  4. Plug Raspberry Pi in, SSH using ssh ubuntu@ip-address-here with password ubuntu, change password.
  5. Change username. Instructions here sudo adduser myUserName, sudo usermod -aG sudo myUserName && sudo userdel ubuntu ref
  6. Setup locale by editing .bashrc
@timotheos
timotheos / fishers_lda.py
Last active May 27, 2019 16:54
Fisher's Linear Discriminant Analysis (LDA) is a dimension reduction technique that can be used for classification
import numpy as np
class_1 = np.array([[4,1],[2,4],[2,3],[3,6],[4,4]], dtype=np.float64)
class_2 = np.array([[9,10],[6,8],[9,5],[8,7],[10,8]], dtype=np.float64)
m_1, m_2, s_1, s_2, s_w = ([] for i in range(5))
m_1 = np.append(m_1, np.sum(class_1, axis=0)/len(class_1), axis=0)
m_2 = np.append(m_2, np.sum(class_2, axis=0)/len(class_2), axis=0)
print("m_1:", m_1, "\nm_2:", m_2)
@timotheos
timotheos / tensorflow-install.md
Created July 15, 2019 14:10
Conda + TensrFlow-gpu and Keras

Installation of Tensorflow and Keras

Obtained from naomi.fridman

Install Miniconda

Install Nvidia drivers

driver installation

  • '$ sudo apt update'
@timotheos
timotheos / gist:36f7e5471fe18876de054596b93b7d25
Created January 16, 2020 11:11 — forked from bhurlow/gist:3043629
Linux Screen Cheat Sheets
–ctrl a c -> cre­ate new win­dow
–ctrl a A -> set win­dow name
–ctrl a w -> show all win­dow
–ctrl a 1|2|3|… -> switch to win­dow n
–ctrl a ” -> choose win­dow
–ctrl a ctrl a -> switch between win­dow
–ctrl a d -> detach win­dow
–ctrl a ? -> help
–ctrl a [ -> start copy, move cur­sor to the copy loca­tion, press ENTER, select the chars, press ENTER to copy the selected char­ac­ters to the buffer
–ctrl a ] -> paste from buffer
@timotheos
timotheos / hundredyo.py
Last active February 18, 2021 14:41
Exercise 1 practicepython.org
def age_to_year(age):
year = 2021 + 100 - int(age)
return year
name = str(input("name?"))
age = int(input("age?"))
multiplier = int(input("How many times?"))
for multiply in range(multiplier):
print(name + " will turn 100 years old in " + str(age_to_year(age)))