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 / legacy_spells_mover.py
Created July 6, 2023 09:19
legacy_spells_mover
import os
import re
import shutil
# Get current dir
dir_path = os.getcwd()
for root,dirs,files in os.walk(dir_path):
for file in files:
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()
# 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):
@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:
@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 / 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 / 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 / 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 / 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