Skip to content

Instantly share code, notes, and snippets.

View enochchu's full-sized avatar
🐦
caw caw!

Enoch Chu enochchu

🐦
caw caw!
View GitHub Profile
@enochchu
enochchu / pandoc-install.sh
Created December 3, 2020 09:20
Install Pandoc
sudo apt install pdflatex texlive-fonts-extra texlive-fonts-recommended texlive-latex-base texlive-latex-extra
@enochchu
enochchu / test.rb
Last active June 1, 2018 07:03
Pseudo Code Ruby
class Test
def selectNode(shoeSize)
# Let's assume the cells is on a web page. And we are using
# selenium to parse the boxes.
# Here are some boilerplate code I found
driver = Selenium::WebDriver.for :firefox
driver.navigate.to "http://127.0.0.1/boxes"
# http://seleniumhq.github.io/selenium/docs/api/rb/Selenium/WebDriver/SearchContext.html#find_elements-instance_method
boxElements = driver.find_elements(:id,"boxes")
@enochchu
enochchu / examples.py
Created January 10, 2018 02:23
Python Examples
import requests
## Login
client = requests.session()
self.login(client)
def login(self, client, url, username, password):
client.get(url)
@enochchu
enochchu / router.php
Created August 31, 2015 06:17
Router.php
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
set_include_path(get_include_path().':'.__DIR__);
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
$path = rtrim($path,'/').'/index.php';
if(strpos($path,'.php') === false) return false;
@enochchu
enochchu / buildSprite.sh
Last active December 21, 2015 03:58 — forked from jaymzcd/buildSprite.sh
#!/bin/bash
# uses imagemagick to stich together all images in a folder and
# then writes a css file with the correct offsets along with a
# test html page for verification that its all good
if [ $# -gt 0 ]
then
if [ $3 ]
then