Skip to content

Instantly share code, notes, and snippets.

View azye's full-sized avatar
🌋

Alex Ye azye

🌋
View GitHub Profile
@azye
azye / css_units.txt
Last active December 18, 2018 05:10
em - Relative to the font-size of the element (2em means 2 times the size of the current font)
ex - Relative to the x-height of the current font (rarely used)
ch - Relative to width of the "0" (zero)
rem - Relative to font-size of the root element
vw - Relative to 1% of the width of the viewport*
vh - Relative to 1% of the height of the viewport*
vmin - Relative to 1% of viewport's* smaller dimension
vmax - Relative to 1% of viewport's* larger dimension
% - Relative to the parent element

Useful Bash

Useful bash stuff that I found during my time diving into linux. Hope somebody stumbles on this and finds it useful.

! bang shortcuts

!!

Stores the most recently run command

Ctrl+W s           split horizontally (or :sp)
Ctrl+W v           split vertically (or :vsp)
Ctrl+W h/j/k/l     change split
Ctrl+W +/-         increase/decrease height (ex. 20<C-w>+)
Ctrl+W >/<         increase/decrease width (ex. 30<C-w><)
Ctrl+W _           set height (ex. 50<C-w>_)
Ctrl+W |           set width (ex. 50<C-w>|)
Ctrl+W =           equalize width and height of all windows
Ctrl + w _ max out the height of the current split
@azye
azye / react_from_scratch.md
Last active June 7, 2019 04:29
building a react project without a toolchain (WIP)

React From Scratch

TLDR of how to make a starter react project from scratch so we don't have a black box toolchain. This guide is no hand holding -- use it if you generally understand how project organization scaffolding works and how JS/Babel/Webpack work together.

Prerequisites

  • npm
  • node

Create a project directory

@azye
azye / ring.c
Last active September 26, 2019 22:22
cool program that was sent to me... compile with gcc and run.
k;double sin()
,cos();main(){float A=
0,B=0,i,j,z[1760];char b[
1760];printf("\x1b[2J");for(;;
){memset(b,32,1760);memset(z,0,7040)
;for(j=0;6.28>j;j+=0.07)for(i=0;6.28
>i;i+=0.02){float c=sin(i),d=cos(j),e=
sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*
h*e+f*g+5),l=cos (i),m=cos(B),n=s\
in(B),t=c*h*g-f* e;int x=40+30*D*
@azye
azye / algoz
Created October 20, 2019 21:24
prefix sum,https://www.geeksforgeeks.org/prefix-sum-array-implementation-applications-competitive-programming/,https://leetcode.com/problems/flip-string-to-monotone-increasing/solution/
#!/usr/bin/env python
import os, argparse, sys, time, shutil
MS_CONVERT_TIME = 1000
parser = argparse.ArgumentParser(description='Rename image filenames')
parser.add_argument('start', type=int, help='starting ID to use as ballot ID')
parser.add_argument('input', help='input directory of images')
No Name Default Action Description
1 SIGHUP terminate process terminal line hangup
2 SIGINT terminate process interrupt program
3 SIGQUIT create core image quit program
4 SIGILL create core image illegal instruction
5 SIGTRAP create core image trace trap
6 SIGABRT create core image abort program (formerly SIGIOT)
7 SIGEMT create core image emulate instruction executed
8 SIGFPE create core image floating-point exception
9 SIGKILL terminate process kill program
@azye
azye / authorized_ssh.sh
Last active June 8, 2022 06:44
Add an authorized key to your linux user
SSH_KEY=<ssh_key>
mkdir -p $HOME/.ssh
touch $HOME/.ssh/authorized_keys
echo $SSH_KEY > $HOME/.ssh/authorized_keys
chmod 700 $HOME/.ssh
chmod 600 $HOME/.ssh/authorized_keys
chown -R $(whoami):$(whoami) $HOME/.ssh

do git stash better

Stashes with a message

$ git stash save “Your stash message”.

List your stashes

$ git stash list