Skip to content

Instantly share code, notes, and snippets.

View noizbuster's full-sized avatar
😎
Awesome

NoizBuster (Wonwoo) noizbuster

😎
Awesome
View GitHub Profile
@noizbuster
noizbuster / ubuntu24.04.md
Last active July 16, 2024 07:05
Ubuntu 24.04

update ubuntu

sudo apt update
sudo apt dist-upgrade && sudo apt autoremove && sudo apt autoclean

ubuntu-restricted-extras (when you forgot installing extra softwares)

@noizbuster
noizbuster / hookstate.helper.js
Created July 31, 2021 17:09
utilities for hookstate
import _ from 'lodash';
export function cloneState(stateValue, path) {
const value = path ? _.get(stateValue, path) : stateValue;
if (!value) {
return value;
}
return JSON.parse(JSON.stringify(value));
}
@noizbuster
noizbuster / localStorageAtom.ts
Created July 31, 2021 17:07
persistent recoil.js atom using local storage
import { atom, AtomEffect, AtomOptions, DefaultValue } from 'recoil';
export const localStorageEffect =
(key: string): AtomEffect<any> =>
({ setSelf, onSet }) => {
const savedValue = localStorage.getItem(key);
if (savedValue != null) {
setSelf(JSON.parse(savedValue));
}
@noizbuster
noizbuster / hyper_as_default_terminal.sh
Created June 11, 2021 18:06
hyper as default terminal of ubuntu
which hyper
# /usr/local/bin/hyper
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/local/bin/hyper 0
sudo update-alternatives --set x-terminal-emulator /usr/local/bin/hyper
@noizbuster
noizbuster / .sh
Created June 7, 2021 10:46
Create SSH Key Pair for Github deployment
ssh-keygen -m PEM -t rsa -b 4096 -f ./keyFileName -C "[email protected]"
@noizbuster
noizbuster / react.page.jsx
Created November 19, 2020 00:11
how to print react component as full-size
function ReactPage(props) {
const printingTarget = useRef(null);
const iframe4print = useRef(null);
function onPrintButtonClick() {
let content = printingTarget.current;
let pri = iframe4print.current.contentWindow;
pri.document.open();
pri.document.write(`<html lang="ko">${document.head.innerHTML}<body>${content.innerHTML}</body></html>`);
pri.document.close();
@noizbuster
noizbuster / launching_workspace.sh
Created November 17, 2020 05:30
Executes terminal and editor and move them to specific gnome workspace
#!/bin/bash
backend_path="/home/username/project/admin/my-project-backend"
frontend_path="/home/username/project/admin/my-project-frontend"
terminator --working-directory=$backend_path -T ADMIN_BACKEND &&
until wmctrl -l | grep -q "ADMIN_BACKEND";
do
sleep 0.1
done
wmctrl -r ADMIN_BACKEND -t 2
@noizbuster
noizbuster / Ubuntu.md
Last active November 10, 2022 07:36
Ubuntu Setting

remove unnecessary apps

  • (under 18.04) amazon app4
  • games (like sudoku...)

update ubuntu

sudo apt update
sudo apt dist-upgrade && sudo apt autoremove && sudo apt autoclean
@noizbuster
noizbuster / destructuring.js
Last active March 21, 2019 04:11
Example for destructuring
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
class TestClass {
constructor({a = 1, b = 2, c, d, ...extra} = {d: 4}) {
this.data = {a, b, c, d};
this.extra = extra;
}
toString() {
console.log(`a = ${this.data.a}, b = ${this.data.b}, c = ${this.data.c}, d = ${this.data.d}, extra = ${this.extra}`)
}