Skip to content

Instantly share code, notes, and snippets.

View CharlieYe0205's full-sized avatar

CharlieYe0205

View GitHub Profile
@CharlieYe0205
CharlieYe0205 / ubuntu_18_04_fun.md
Last active May 1, 2022 12:11
Ubuntu 18.04 Fun

E: Encountered a section with no Package: header

gunzip /var/backups/dpkg.status.1.gz
sudo gunzip /var/backups/dpkg.status.1.gz
head /var/backups/dpkg.status.1
sudo cp /var/backups/dpkg.status.1 /var/lib/dpkg/status
sudo apt-get update

invalid value for parameter "lc_monetary": "en_US.UTF-8"

@CharlieYe0205
CharlieYe0205 / launch_item2_on_login.md
Created December 29, 2019 22:22
Launch Item2 on Login
  1. lauch item 2
  2. close all current tabs
  3. cmd-shift-s to save a window arrangement
  4. item2 -> prefs -> arrangements to make it default
  5. item2 -> pref -> general to have it open the default window arrangement at startup
  6. Add item2 to login item and hide it
Happy Coding ^_^
@CharlieYe0205
CharlieYe0205 / deploy_react_with_nginx.md
Last active May 1, 2022 03:51
Deploy React with Nginx
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs build-essential libpng-dev python2
node --version

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update
sudo apt install -y yarn
@CharlieYe0205
CharlieYe0205 / npm_fun.md
Last active September 11, 2019 05:55
Npm Fun

assign port: create a .env file in the porject directory

PORT=3001

How to reference a scss files installed to node_modules?

@import '~@material/react-button/index.scss';
@CharlieYe0205
CharlieYe0205 / git_fun.md
Last active July 12, 2020 01:02
Git Fun

print git command results to stdout

git config --global core.pager "less -FRSX"

fix mac os upgrade issue

sudo xcode-select --install
@CharlieYe0205
CharlieYe0205 / lodash_fun.md
Last active August 21, 2019 07:18
Lodash Fun

map

_.map(users, 'name')

filter

_.filter(users, {name: 'John'}) # get all users whose name is John, return array
@CharlieYe0205
CharlieYe0205 / kafka_fun.md
Last active August 20, 2019 06:55
Kafka Fun

zookeeper.properties

dataDir={ new_data_dir_instead_of_tmp }/data/zookeeper

server.properties

log.dirs={ new_log_dir_instead_of_tmp }/data/kafka/logs
num.partitions=3 // change this to set default partitions numbers when create topic
@CharlieYe0205
CharlieYe0205 / react_call_function_of_undefined.md
Created July 18, 2019 00:10
React call function of undefined

change

function_name() {};

to

function_name = () => {};
@CharlieYe0205
CharlieYe0205 / rvm_rbenv_switch_ruby_version.md
Created July 8, 2019 04:40
Rvm and Rbenv switch ruby version automatically

create a .ruby-version file

2.6.3

Both rvm and rbenv can use this file to switch ruby versions automatically.

@CharlieYe0205
CharlieYe0205 / brew_install_postgres_issue.md
Last active July 14, 2019 22:41
Brew install Postgres Issue

Install postgres via brew may have the following problem

psql: could not connect to server: No such file or directory. Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start