Skip to content

Instantly share code, notes, and snippets.

View jxu's full-sized avatar
:shipit:

jxu

:shipit:
  • Wit's End
View GitHub Profile
import pandas as pd
### Data import ###
# https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html
df = pd.read_csv("file.csv")
### Data types ###
@jxu
jxu / spelling-bee.sh
Last active May 2, 2024 23:22
NYT puzzle game solver
grep -Pi '^(?=.*u)[bluntam]{4,}$' /usr/share/dict/words
@jxu
jxu / SQL_cheatsheet.sql
Last active May 2, 2024 23:20
Specifically for T-SQL, probably for other SQLs
-- Syntax order
-- https://learn.microsoft.com/en-us/sql/t-sql/queries/select-transact-sql
WITH cte AS (cte_query)
SELECT cols
FROM table
WHERE cond
GROUP BY col
HAVING cond
WINDOW window_expr
# push to new github repo
git remote add origin git@github.com:jxu/repo.git # use set-url if already set
git push -u origin master
# check out a remote branch
git fetch
git branch -v -a # list all branches
git switch branchname
# Throw away all changes, staged and unstaged
@jxu
jxu / .vimrc
Created February 4, 2024 05:13
vimrc (again)
" Custom vim config with my comments
" (mostly from the ultimate Vim config amix/vimrc)
" => General
set nocompatible " Disable compatibility mode
set history=1000 " Save more commands
set autoread " Read file when changed externally
set autowrite " Autosave before commands like :make
set noswapfile " No more .swp!
@jxu
jxu / chemical_symbol_words.txt
Last active May 4, 2024 00:19
chem-symbol-words old
Ac
Accra
Achebe
Achernar
Acheson
Acosta
Acts
Acuff
Ag
Agassi
@jxu
jxu / android-transfer.py
Last active November 11, 2023 00:18
android-transfer repo old 2017-11-26
#!/bin/env python3
# Trying to automate android backups but fed up with bash :(
# TODO: Nicer mode selection?
import os
import subprocess
import sys
SD_DIR = "sdcard1"
@jxu
jxu / yt-audio.sh
Created December 31, 2022 13:47
download mp3 at default best yt audio quality
alias yt-audio='yt-dlp -x --audio-format mp3'
rsync -av --progress --inplace --omit-dir-times --no-perms --delete-after --exclude='.git/' music-player/ '/run/user/1000/gvfs/mtp:host=Google_Pixel_4a_0A101JEC213910/Internal shared storage/Music/'
import sqlite3
import json
import os
DATA_DIR = "data"
def main():
conn = sqlite3.connect("danbooru2018.db")
c = conn.cursor()