Skip to content

Instantly share code, notes, and snippets.

View crazyoptimist's full-sized avatar
🐌
crawling

crazyoptimist crazyoptimist

🐌
crawling
View GitHub Profile
@crazyoptimist
crazyoptimist / vim-install-note.md
Created April 25, 2021 23:45
Install Vim From the Source on Fedora/CentOS

Installing Vim by building from the source needs bunch of dependancies.

Setup essential build environment

yum -y groupinstall "Development Tools"
yum -y install ncurses-devel git-core

Get the source

@crazyoptimist
crazyoptimist / compose.yaml
Last active May 6, 2024 15:52
Redis with Docker Compose
name: redis
services:
redis:
image: redis:7
container_name: redis
command: "redis-server --loglevel warning"
volumes:
- redis_data:/data/
ports:
@crazyoptimist
crazyoptimist / nvm-install.sh
Last active March 28, 2024 07:39
Install the latest version of nvm, node, npm
#!/bin/bash
# Check the latest version of NVM
curl https://github.com/nvm-sh/nvm/releases/latest | cut -d \/ -f 8 | cut -d \" -f 1
# Run the install script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
# Paste in this scripts into your .bashrc or .bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Install node and npm
@crazyoptimist
crazyoptimist / app.js
Created October 25, 2020 19:20
Concept of Promise in Javascript
const fs = require('fs');
(() => {
return new Promise(async (resolve, reject) => {
try {
let file = fs.readFileSync(`${__dirname}/app.js`)
resolve(file)
} catch (err) {
reject(`Oops! \n ${err}`)
}
@crazyoptimist
crazyoptimist / install-docker.sh
Last active April 30, 2024 20:33
Install the latest version of docker engine on Ubuntu machines
#!/bin/bash
# Uninstall all conflicting packages:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg --purge -y; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl -y
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
@crazyoptimist
crazyoptimist / arch-with-kde.md
Last active April 10, 2024 00:58
Arch Linux w/ KDE Installation Note by crazy0ptimist

Alright, here you go ...

#check if network is connected
ip link
ping google.com
#sync time
timedatectl set-ntp true
#check partition info
fdisk -l
@crazyoptimist
crazyoptimist / How-to-Win-Friends-and-Influence-People.md
Created July 26, 2020 08:33 — forked from justincampbell/How-to-Win-Friends-and-Influence-People.md
Principles of How to Win Friends and Influence People

How to Win Friends and Influence People

Fundamental Techniques in Handling People

  1. Don't criticize, condemn, or complain.
  2. Give honest and sincere appreciation.
  3. Arouse in the other person an eager want.
  4. Never show others that you are not interested in what they have to say.
@crazyoptimist
crazyoptimist / compose.yaml
Last active May 6, 2024 15:54
PostgreSQL deployment using docker-compose
name: postgres
services:
postgresql:
image: postgres:16
container_name: postgresql
environment:
- POSTGRES_USER=superuser
- POSTGRES_PASSWORD=youmayneverguess
@crazyoptimist
crazyoptimist / image-clean.sh
Last active November 26, 2020 22:03
Remove <none> tagged docker images
if [ -z "$(docker images | awk '/^<none>/ {print $3}')" ]; then
echo "You don't have any <none> tagged images."
else
docker rmi $(docker images | awk '/^<none>/ {print $3}')
fi
@crazyoptimist
crazyoptimist / compose.yaml
Last active April 10, 2024 00:42
MySQL 8 with Docker Compose
name: mysql
services:
mysql:
image: mysql:8
container_name: mysql
ports:
- "3306:3306"
command:
[