Skip to content

Instantly share code, notes, and snippets.

View z3niths's full-sized avatar
🏆

March Kasama Kaewsainguan z3niths

🏆
View GitHub Profile
@z3niths
z3niths / A-CloudLoggingLibraryUsages
Last active September 13, 2022 07:29
Logging client libraries
Install :
`dotnet add package Google.Cloud.Logging.V2`
@z3niths
z3niths / my.cnf
Created December 8, 2020 04:08 — forked from kanibaspinar/my.cnf
Mysql My.cnf Optimization - Best Performance For 1000 + Sites Web Server
# Optimized MySQL configuration for cPanel servers by Kani Baspinar - Updated June 2016
#
# The settings provided below are a starting point for a 24GB RAM server with 8 CPU cores.
# If you have less or more resources available you MUST adjust accordingly to save CPU, RAM and disk I/O usage.
# To fine tune these settings for your system, use MySQL DB diagnostics tools like:
# Test your configuration ; https://launchpad.net/mysql-tuning-primer
# or
# http://blog.mysqltuner.com/download/
# Note that if there is NO comment beside a setting, then you don't need to adjust it.
#
To help you with the process of converting a MySQL app to PostgreSQL, I collected a list of differences between MySQL and PostgreSQL (PG).
Important changes:
* Strings are quoted with '...' or with $token$...$token$. Single-quotes are escaped with single-quotes.
* Identifiers are folded to lowercase, unless they are quoted with "..." which makes them case-sensitive
* The max identifier length is 63
* There are some system columns that cannot be used as an identifier (probably not a problem)
* Expressions are evaluated in arbitrary order, so WHERE x > 0 AND y/x > 1.5 can lead to a division by zero and has to be replaced with WHERE CASE WHEN y > 0 THEN y/x > 1.5 ELSE FALSE END
* SELECT CASE WHEN x > 0 THEN x ELSE 1/0 END would still lead to a division by zero because the constant 1/0 is evaluated even before the query starts
- Key-value / Fast / Limited space / machine memory
-- Redis , Memcache , EdgeDb
--- Caching
--- Pub/sub
--- LeaderBoard
- Wide column (key value + more dimension) / Schema-less /without joins
-- Crasandra, Apache Hbase
--- Time-series
--- Historical Records
-----BEGIN DH PARAMETERS-----
MIIBCAKCAQEA//////////+t+FRYortKmq/cViAnPTzx2LnFg84tNpWp4TZBFGQz
+8yTnc4kmz75fS/jY2MMddj2gbICrsRhetPfHtXV/WVhJDP1H18GbtCFY2VVPe0a
87VXE15/V8k1mE8McODmi3fipona8+/och3xWKE2rec1MKzKT0g6eXq8CrGCsyT7
YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi
7MA0BM0oNC9hkXL+nOmFg/+OTxIy7vKBg8P+OxtMb61zO7X8vC7CIAXFjvGDfRaD
ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg==
-----END DH PARAMETERS-----
# This file contains important security parameters. If you modify this file
# manually, Certbot will be unable to automatically provide future security
# updates. Instead, Certbot will print and log an error message with a path to
# the up-to-date file that you will need to refer to when manually updating
# this file.
ssl_session_cache shared:le_nginx_SSL:10m;
ssl_session_timeout 1440m;
ssl_session_tickets off;
@z3niths
z3niths / postgres-cheatsheet.md
Created September 25, 2020 05:14 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@z3niths
z3niths / decrypt.cpp
Created June 21, 2020 18:50 — forked from haram/decrypt.cpp
Escape From Tarkov encryption defeated
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
// yousif, namazso, can1357, defcon42
namespace packet
{
constexpr size_t be_xor_key = 0xd774f59d;
@z3niths
z3niths / decrypt.cpp
Created June 21, 2020 18:50 — forked from haram/decrypt.cpp
Escape From Tarkov encryption defeated
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
// yousif, namazso, can1357, defcon42
namespace packet
{
constexpr size_t be_xor_key = 0xd774f59d;
@z3niths
z3niths / webpack.config.js
Created November 13, 2019 02:17 — forked from dgrigg/webpack.config.js
Webpack + Twig setup
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const WebpackNotifierPlugin = require('webpack-notifier');
const TailwindCss = require('tailwindcss');
const AutoPrefixer = require('autoprefixer');
const path = require('path');