Skip to content

Instantly share code, notes, and snippets.

@budiantoip
budiantoip / ReactJS Cheatsheet
Created April 12, 2021 11:28
ReactJS Cheatsheet
// Create react app in the current folder
npx create-react-app .
// React’s useEffect Hook to call API
@budiantoip
budiantoip / Docker Compose for Swarm
Created April 22, 2021 13:57
Docker Compose for Swarm
version: '3.1'
services:
wordpress:
image: wordpress
deploy:
replicas: 1
restart_policy:
condition: on-failure
@budiantoip
budiantoip / deploy.sh
Created May 4, 2021 00:54 — forked from BenSampo/deploy.sh
Laravel deploy script
# Change to the project directory
cd /home/forge/domain.com
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin master
@budiantoip
budiantoip / NestJS
Last active August 7, 2021 21:04
NestJS
// install the cli command
npm -i g @nestjs/cli
// create a new project
nest new <project_name>
// Create a controller
nest g controller <controller_name>
// Create a service
@budiantoip
budiantoip / Angular
Last active March 2, 2022 03:56
Angular
// Install Angular CLI
npm install -g @angular/cli
// Use a specific version of Angular
npm uninstall -g @angular/cli
npm install -g @angular/cli@12 // Install Angular 12
ng new my-app // Create new app using angular 12
// Setup a new Angular app
ng new blog
@budiantoip
budiantoip / Javascript Snippets
Created March 16, 2022 19:45
Javascript Snippets
function clearCookies() {
if (location.hostname == 'domain.com') {
document.cookie.replace(
/(?<=^|;).+?(?=\=|;|$)/g,
name => location.hostname
.split(/\.(?=[^\.]+\.)/)
.reduceRight((acc, val, i, arr) => i ? arr[i]='.'+val+acc : (arr[i]='', arr), '')
.map(domain => document.cookie=`${name}=;max-age=0;path=/;domain=${domain}`)
);
@budiantoip
budiantoip / Podman
Last active May 12, 2022 21:00
Podman
// check the podman version
sudo podman --version
// search for container image
sudo podman search rhel
// search with filter
sudo podman search rhel --filter="is-official=true"
// pull image
@budiantoip
budiantoip / Learn Vagrant
Last active June 1, 2022 06:04
Learn Vagrant
Reference: https://www.youtube.com/watch?v=PmOMc4zfCSw
To download the latest vagrant, visit:
https://www.vagrantup.com/downloads
To install Vagrant on mac, simply run this in the terminal:
brew install vagrant
To search for vagrant VMs or boxes, visit:
https://app.vagrantup.com/boxes/search
@budiantoip
budiantoip / openssl commands
Created June 3, 2022 10:34
openssl commands
Reference:
https://djangocas.dev/blog/test-tls-connectivity-with-openssl/#use--connect-hostport-to-connect-to-a-tls-server
============================================================
Summary: openssl s_client commands examples quick references
============================================================
Test TLS connection:
openssl s_client -connect www.google.com:443
Show all certificates chain:
@budiantoip
budiantoip / Learn Github Actions
Last active June 6, 2022 07:42
Learn Github Actions
Reference :
https://www.youtube.com/watch?v=TLB5MY9BBa4
Github actions are basically composed of 3 components, they are:
- Events
- Workflows
- Actions
The events will trigger the workflows, and the workflows will trigger the actions.
======