Skip to content

Instantly share code, notes, and snippets.

View haeramkeem's full-sized avatar

@haeramkeem haeramkeem

View GitHub Profile
@haeramkeem
haeramkeem / git_tag.sh
Created May 26, 2022 12:29
Git tag example
#!/bin/bash
# Add tag
git tag -a v1.0.0 -m"My release 1.0.0"
# Delete tag
git tag -d v1.0.0
# Push origin tag
git push origin v1.0.0
@haeramkeem
haeramkeem / dpkg_frontend_lock_error.sh
Created June 3, 2022 00:28
dpkg: error: dpkg frontend lock is locked by another process
#!/bin/bash
# dpkg: error: dpkg frontend lock is locked by another process
# Ref: https://askubuntu.com/a/291584
# Check PID of the running dpkg process
lsof /var/lib/dpkg/lock
# See status of the process
ps cax | grep ${PID}
@haeramkeem
haeramkeem / sed_remove_all_whitespace.sh
Created June 3, 2022 15:26
SED remove all whitespace
#!/bin/bash
# Remove all whitespace
# Ref: https://www.baeldung.com/linux/remove-whitespace-from-file#2-removing-all-whitespace-characters-
sed ':a; N; s/[[:space:]]//g; ta' testfile.txt
@haeramkeem
haeramkeem / curl_cookie.sh
Created June 3, 2022 15:27
cURL with cookie
@haeramkeem
haeramkeem / curl_post.sh
Created June 3, 2022 15:28
cURL with HTTP/POST
#!/bin/bash
# Ref: https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=wideeyed&logNo=221350638501
curl -d '{"key1":"value1", "key2":"value2"}' \
-H "Content-Type: application/json" \
-X POST http://localhost:8000/data
@haeramkeem
haeramkeem / mysql_show_tables.sql
Created June 3, 2022 15:31
MySQL / MariaDB show table list
SHOW TABLES;
#!/bin/bash
# https://www.cyberciti.biz/faq/how-to-show-recursive-directory-listing-on-linux-or-unix/
# show filename only
ls -R
# show file structure
find . -print
@haeramkeem
haeramkeem / mysql_drop_all_tables.sql
Created June 4, 2022 05:54
MySQL drop all tables
DROP DATABASE test_db;
CREATE DATABASE test_db;
@haeramkeem
haeramkeem / mysql_delete_rows.sql
Created June 4, 2022 05:55
MySQL delete rows
DELETE FROM testdb;
@haeramkeem
haeramkeem / mysql_show_table_scheme.sql
Created June 5, 2022 03:01
MySQL get table schema
-- https://www.mysqltutorial.org/mysql-show-columns/
DESCRIBE table_name;