Skip to content

Instantly share code, notes, and snippets.

View jxu's full-sized avatar
:shipit:
If it compiles it ships

jxu

:shipit:
If it compiles it ships
  • Wit's End
View GitHub Profile
@jxu
jxu / git-cheatsheet.sh
Last active December 4, 2024 18:56
Useful git commands
# push to new github repo
git remote add origin [email protected]: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
# change remote a branch is tracking
@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 / 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 / thinkpad_rsync.sh
Last active September 6, 2024 00:20
Backup for Ubuntu
#!/bin/sh
# -n for dry run, --del to delete at dest
# --info and --no-i-r just for showing progress
rsync -avh --del /home/jx --info=progress2 --no-i-r --stats \
--exclude .local/share/Trash --exclude .cache \
'/media/jx/Toshiba 2TB/ubuntu_backup_latest' 2> rsync.err
@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()
library(tidyverse)
library(gridExtra)
set.seed(10716)
gaussian_matrix <- function(nrow, ncol, mean, sd) {
matrix(rnorm(nrow*ncol, mean, sd), nrow, ncol)
}
uniform_matrix <- function(nrow, ncol, min, max) {
# https://help.github.com/articles/changing-author-info/
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="jxu"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"