Skip to content

Instantly share code, notes, and snippets.

View lequocvuong's full-sized avatar

Vuong Le lequocvuong

View GitHub Profile
@lequocvuong
lequocvuong / Redis-cli commands.md
Created January 8, 2025 08:05 — forked from vanushwashere/Redis-cli commands.md
Redis CLI most used and basic commands

Source

https://habrahabr.ru/post/204354/

Authentication

bash> redis-cli -h 127.0.0.1 -p 6379 -a mysupersecretpassword //with ip bash> redis-cli -s /tmp/redis.sock -p 6379 -a mysupersecretpassword //with socket

or

redis> AUTH mysupersecretpassword

@lequocvuong
lequocvuong / README.md
Created November 13, 2023 20:53 — forked from kharysharpe/README.md
Hourly and Daily MYSQL Backup / Dump with Retention Period

Steps

Create directories

mkdir -p /backup/mysql/hourly
mkdir -p /backup/mysql/daily

Set permissions on scripts:

@lequocvuong
lequocvuong / resetteamviewer.py
Created November 9, 2023 16:05 — forked from nghminh163/resetteamviewer.py
Reset ID Teamviewer
#!/usr/bin/env python
#coding:utf-8
import sys
import os
import glob
import platform
import re
import random
import string
@lequocvuong
lequocvuong / sql.md
Created October 19, 2023 12:51 — forked from anilahir/sql.md
MySQL transaction within stored procedure example

Create stored procedure :

DROP PROCEDURE IF EXISTS sp_delete_users_till_date;

DELIMITER //

CREATE PROCEDURE sp_delete_users_till_date(location_id INT, till_date DATE)
@lequocvuong
lequocvuong / Apple_mobile_device_types.txt
Created October 9, 2023 08:10 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@lequocvuong
lequocvuong / gist:35108b88ad2c660a0f14f43bc480f8ea
Created October 4, 2023 22:18 — forked from bryhal/gist:4129042
MYSQL: Generate Calendar Table
DROP TABLE IF EXISTS time_dimension;
CREATE TABLE time_dimension (
id INTEGER PRIMARY KEY, -- year*10000+month*100+day
db_date DATE NOT NULL,
year INTEGER NOT NULL,
month INTEGER NOT NULL, -- 1 to 12
day INTEGER NOT NULL, -- 1 to 31
quarter INTEGER NOT NULL, -- 1 to 4
week INTEGER NOT NULL, -- 1 to 52/53
day_name VARCHAR(9) NOT NULL, -- 'Monday', 'Tuesday'...
-- In pg_stat_statements, there is a problem: sometimes (quite often), it registers the same query twice (or even more).
-- It's easy to check in your DB:
--
-- with heh as (
-- select userid, dbid, query, count(*), array_agg(queryid) queryids
-- from pg_stat_statements group by 1, 2, 3 having count(*) > 1
-- ) select left(query, 85) || '...', userid, dbid, count, queryids from heh;
--
-- This query gives you "full picture", aggregating stats for each query-database-username ternary
@lequocvuong
lequocvuong / partition.sql
Created August 16, 2023 21:34 — forked from l1x/partition.sql
Creating PostgreSQL table partitions automatically based on the date field (type date as well) -- each day is a single partition
CREATE TABLE testing_partition(patent_id BIGINT, date DATE) WITH ( OIDS=FALSE);
CREATE OR REPLACE FUNCTION create_partition_and_insert() RETURNS trigger AS
$BODY$
DECLARE
partition_date TEXT;
partition TEXT;
BEGIN
partition_date := to_char(NEW.date,'YYYY_MM_DD');
partition := TG_TABLE_NAME || '_' || partition_date;
@lequocvuong
lequocvuong / postgres-brew.md
Created August 6, 2023 08:44 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@lequocvuong
lequocvuong / oracle-19.txt
Created May 28, 2023 09:27 — forked from devops-school/oracle-19.txt
How to Install Oracle Database 19c on centos 7
1. To begin, make sure that all the packages currently installed on your RHEL/CentOS 7 system are updated to their latest versions.
# yum update -y
2. Next, installed all the required dependencies for the RDBMS, along with the zip and unzip packages.
# yum install -y binutils.x86_64 compat-libcap1.x86_64 gcc.x86_64 gcc-c++.x86_64 glibc.i686 glibc.x86_64 glibc-devel.i686 glibc-devel.x86_64 ksh compat-libstdc++-33 libaio.i686 libaio.x86_64 libaio-devel.i686 libaio-devel.x86_64 libgcc.i686 libgcc.x86_64 libstdc++.i686 libstdc++.x86_64 libstdc++-devel.i686 libstdc++-devel.x86_64 libXi.i686 libXi.x86_64 libXtst.i686 libXtst.x86_64 make.x86_64 sysstat.x86_64 zip unzip
3. Create the user account and groups for Oracle.
# groupadd oinstall
# groupadd dba