Skip to content

Instantly share code, notes, and snippets.

View Hosuke's full-sized avatar
🐢
I code slowly

Huang Geyang Hosuke

🐢
I code slowly
View GitHub Profile
@Hosuke
Hosuke / setGit.md
Last active August 29, 2015 14:07
Setting Up Git Workspace

####Restart Git Bash or your terminal

Once you’ve completed the following instructions, you'll need to close and re-open Git Bash (if you are using Windows) or your terminal (if you are using Mac or Linux). Many of the configurations listed here will not take place until you have done this, so if you don’t see your changes taking place right away, this is probably why.

####Downloading necessary files

Later in these instructions, you'll need the two files git-completion.bash and git-prompt.sh. To download them:

  • Visit this page, where you can find git-completion.bash.
  • Right click anywhere on the page and select "Save As..."
@Hosuke
Hosuke / .bash_profile
Created October 11, 2014 14:12
Bash profile for Git
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
# Change command prompt
@Hosuke
Hosuke / viewBoxModel
Created October 14, 2014 04:02
Viewing box model from console
[].forEach.call($$("*"),function(a){
a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)
})
@Hosuke
Hosuke / Setting Up Ubuntu workstation guide.md
Last active August 29, 2015 14:09
Setting Up Ubuntu Workstation Guide

By Hosuke

  1. Burn an Ubuntu 14.04 disk

  2. Install it

  3. sudo apt-get update && sudo apt-get upgrade

  4. Disable Unity Dash Online Search feature : wget -q -O - https://fixubuntu.com/fixubuntu.sh | bash

@Hosuke
Hosuke / Create a local web server.md
Created November 21, 2014 11:13
Create a local web server

Using Python SimpleHTTPServer

The simplest way is to use SimpleHTTPServer if you already have Python installed.

Python comes already installed on most Mac OS X and Linux computers. In a terminal window, change to the directory that has your HTML files and run the following command:

python -m SimpleHTTPServer

After it starts, you can navigate to http://0.0.0.0:8000/index.html

@Hosuke
Hosuke / nodenpm.md
Created December 12, 2014 11:08
install latest nodejs and npm on ubuntu
apt-get install python-software-properties
apt-add-repository ppa:chris-lea/node.js
apt-get update
apt-get install nodejs

npm install npm -g

@Hosuke
Hosuke / venv_explained.sh
Last active May 31, 2019 10:14 — forked from wxiaoguang/venv.sh
python3 virtualenv/venv helper bash script (env init, env bootstrap, pip requirement installation, program exec) with explanation
#!/bin/bash
# Go to the location where your script located wherever your run it,
# and store the path contains the script at DIR.
# ${BASH_SOURCE[0]} is a more precised way to locate compare to $0
# https://stackoverflow.com/questions/35006457/choosing-between-0-and-bash-source
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# Set DIR as the working directory.
@Hosuke
Hosuke / lido_spells_renaming_script.py
Created May 19, 2023 16:34
lido_renaming_script.py
import os
# Get the current directory
dir_path = os.getcwd()
# Traverse all files and subdirectories in the current directory
for root, dirs, files in os.walk(dir_path):
for file_name in files:
# Replace 'accounting_ethereum' with 'ethereum_accounting' in the file content
@Hosuke
Hosuke / timestamp_cleaner.py
Last active June 30, 2023 04:54
script to translate spark sql `timestamp()` to dune sql `timestamp`
import os
import re
# Get the current directory
dir_path = os.getcwd()
# Traverse all files and subdirectories in the current directory
for root, dirs, files in os.walk(dir_path):
for file_name in files:
import os
import re
# Get the current directory
dir_path = os.getcwd()
pattern = re.compile(r'LEFT ANTI JOIN (\w+) t ON (t.\w+) = (\w+.\w+)')
def replace_anti_join(match):