Skip to content

Instantly share code, notes, and snippets.

View peter279k's full-sized avatar
🎯
Focusing

Chun-Sheng, Li peter279k

🎯
Focusing
View GitHub Profile
@peter279k
peter279k / read-only-access.sql
Last active August 5, 2020 08:43
This is the SQL script to create read-only access user account on PostgreSQL database
-- References
-- https://serverfault.com/questions/60508/grant-select-to-all-tables-in-postgresql
-- https://blog.redash.io/postgres-readonly/
-- Create a read-only role
CREATE ROLE myapp_readonly_role_name;
GRANT CONNECT ON DATABASE db_name TO myapp_readonly_role_name;
GRANT USAGE ON SCHEMA schema_name TO myapp_readonly_role_name;
@mrcomoraes
mrcomoraes / clear_cache_MS_Teams.sh
Last active February 16, 2024 22:55
Clear cache Microsoft Teams on Linux
#!/bin/bash
# This script cleans all cache for Microsoft Teams on Linux
# Tested on Ubuntu-like, Debian by @necrifede, Arch Linux by @lucas-dclrcq and Manjaro with flatpak by @danie1k. Feel free to test/use in other distributions.
# Tested Teams via snap package.
# Tested Teams via flatpak package.
#
# How to use in terminal:
# ./clear_cache_MS_Teams.sh ( deb-stable | deb-insider | snap | flatpak )
# or
@peter279k
peter279k / facebook-detect-dec.md
Last active April 24, 2022 18:51
Facebook detect fake accounts with deep entity classification
@amalmurali47
amalmurali47 / backup_digitalocean.md
Last active April 9, 2024 18:41
Backup DigitalOcean droplet locally

DigitalOcean does not provide a way to download a snapshot of your droplet locally. You can use rsync to accomplish this instead.

On your local machine, assuming you have added your-server in your SSH config:

rsync -aAXHv --append-verify --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} your-server:/
  • -a : archive mode (all files, with permissions, etc.)
  • -A : preserve ACLs/permissions (not included with -a)
@peter279k
peter279k / KVM_Installation_RHEL8_CentOS8.md
Last active July 17, 2020 13:12
The useful and completed references for KVM installation in RHEL 8 and CentOS 8 (including troubleshooting)
@peter279k
peter279k / Social_Scraper.md
Last active July 10, 2020 17:20
This is reference for social scraper

Facebook

Alternatives and related projects

@peter279k
peter279k / upgrade_apache.sh
Created June 27, 2020 19:27
This is about upgrading Apache server on Ubuntu 16.04 and Ubuntu 18.04
#!/bin/bash
# References:
# https://www.mysterydata.com/update-apache-2-4-to-latest-version-on-ubuntu-16-04-server-vestacp/
sudo_prefix="sudo "
if [[ ${USER} == "root" ]]; then
sudo_prefix=""
else