Skip to content

Instantly share code, notes, and snippets.

View nonrice's full-sized avatar

Eric Xue nonrice

View GitHub Profile
@nonrice
nonrice / yt-itunes.sh
Created February 7, 2022 03:49
Downloads songs from Youtube into iTunes music library (MacOS)
#!/bin/zsh
# Downloads audio and cover art from youtube video and automatically adds to your iTunes music library.
#
# Required packages:
# youtube-dl
# eyeD3
# imageMagick
#
# To use, first make the script runnable:
@nonrice
nonrice / init.vim
Last active January 2, 2023 20:19
can't believe I used to use this
"Run :PlugInstall when opening for the first time, then relaunch nvim
"important thing
filetype plugin indent on
"utility binds
nmap <C-i> <Cmd>:bnext<CR>
tnoremap <Esc> <C-\><C-n>
nnoremap <F6> <Cmd>:vsp<CR>:wincmd l<CR>:e ~/in.txt<CR>
@nonrice
nonrice / todo.cpp
Last active September 1, 2022 02:35
Very simple and minimal todo list CLI.
#include <iostream>
#include <fstream>
#include <string>
#include <cstring>
/* Installation:
* Compile from source: g++ todo.cpp -o todo -O3
* Put it into path: sudo mv ./todo /usr/local/bin
*
* Usage:
@nonrice
nonrice / vimrc
Last active January 2, 2023 20:21
My vimrc
filetype plugin indent on
autocmd filetype cpp nnoremap <F5> <Cmd>:w<CR>:!cprun.zsh %<CR>
autocmd filetype tex nnoremap <F5> <Cmd>:w<CR>:!xelatex % && open %<.pdf<CR>
autocmd filetype python nnoremap <F5> <Cmd>:w<CR>:!python3 % < ~/.in<CR>
nnoremap <F6> <Cmd>:w<CR>:e ~/.in<CR>
set tabstop=4 shiftwidth=4 softtabstop=4 autoindent expandtab
set backspace=2
set number relativenumber
# Command line tool to manage journal entries
#
# SETUP:
# 1. Install required tools: Vim, FZF
# 2. Replace the contents of JOURNAL_DIR with where you want the journal to be
# 3. (Optional) make an alias in your shell RC to easily run the script
JOURNAL_DIR = "/Users/eric/Workspace/journal"
# HOW TO USE:
# Simply run the file and supply arguments if needed
@nonrice
nonrice / amber.conf
Last active October 10, 2022 18:22
Super good colorscheme made by me for kitty terminal
# https://gist.github.com/nonrice/a741901b887a070c37ad93b2e2c14c7a
background #38230D
foreground #FF9729
cursor #FF9729
color0 #38230D
color1 #CE4B16
color2 #9A781E
color3 #FF9721
color4 #8D6020
@nonrice
nonrice / learner.cpp
Last active January 2, 2023 20:21
Quizlet is SH!T
#include <iostream>
#include <algorithm>
#include <array>
#include <random>
#include <chrono>
#include <vector>
#include <string>
#include <fstream>
#include <cstdlib>
@nonrice
nonrice / ttsmaker_query.py
Last active July 17, 2023 16:15
Simple command line tool to interact with TTSMaker API. Automatically split queries by newline to avoid character limit!
import requests, json, argparse, os, uuid, time
def ttsmaker_query(text, output_file, token="ttsmaker_demo_token", voice_id=147, audio_format="wav", speed=1.05, volume=0, paragraph_pause=0):
if "\n" in text:
os.system("sox " + " ".join([ttsmaker_query(text_frag, str(uuid.uuid4())+"."+audio_format, token, voice_id, audio_format, speed, volume, paragraph_pause) for text_frag in text.split("\n")]) + " " + output_file)
return output_file
url = 'https://api.ttsmaker.com/v1/create-tts-order'
headers = {'Content-Type': 'application/json; charset=utf-8'}
params = {