Skip to content

Instantly share code, notes, and snippets.

View Kouni's full-sized avatar
:octocat:
I still loved what I did.

Kouni Kouni

:octocat:
I still loved what I did.
  • Kaohsiung, Taiwan
View GitHub Profile
@Kouni
Kouni / nginx-tuning.md
Created February 13, 2023 19:45 — forked from ironheart122/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

Doing a SELECT on a specific timestamp range

  • Here, the Athena table athena_table has the columns timestamp, day, month, year, id
select timestamp,month,day,year,id
from athena_table

WHERE month = 8 and day = 15
AND (CAST(timestamp as varchar) BETWEEN '2018-08-15 22:00:00' AND '2018-08-15 22:10:00')
 
@Kouni
Kouni / cloudwatch-php-fpm-status.sh
Created June 10, 2022 07:49 — forked from ysasaki/cloudwatch-php-fpm-status.sh
php-fpm status to AWS CloudWatch
#!/bin/bash
AWS_DEFAULT_REGION="ap-northeast-1"
AWS_ACCESS_KEY_ID="YOUR ACCESS KEY HERE"
AWS_SECRET_ACCESS_KEY="YOUR SECRET ACCESS KEY HERE"
INSTANCE_ID_URL="http://169.254.169.254/latest/meta-data/instance-id"
INSTANCE_ID=$(curl -s ${INSTANCE_ID_URL})
SERVER_STATUS_URL="http://localhost/php-fpm-status"
@Kouni
Kouni / bash_strict_mode.md
Created May 27, 2022 03:11 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation
@Kouni
Kouni / config
Last active May 26, 2022 00:54
$HOME/.ssh/
Include config.d/fa/fa.conf
HashKnownHosts yes
StrictHostKeyChecking no
# UserKnownHostsFile /dev/null
TCPKeepAlive yes
ServerAliveInterval 120
ServerAliveCountMax 5
Compression yes
ControlMaster auto
ForwardAgent yes
@Kouni
Kouni / movtomp4.sh
Created April 8, 2022 03:05
Convert mov to mp4
#!/usr/bin/env bash
# find . -type f -name "*.mov" -exec ffmpeg -i {} -vcodec h264 -acodec mp2 {}.mp4 \;
# Reference: https://gist.github.com/dvlden/b9d923cb31775f92fa54eb8c39ccd5a9
# requirement: ffmpqg, rename
workDir=$1
convert() {
find $workDir -type f -name "*.mov" -exec ffmpeg -i {} -vcodec h264 -acodec mp2 {}.mp4 \;
#!/usr/bin/env bash
set -euo pipefail
PROTOC_ZIP=protoc-3.14.0-linux-aarch_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
# https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protoc-3.19.4-linux-aarch_64.zip
unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
@Kouni
Kouni / gpg_git_signing.md
Created October 12, 2021 05:40 — forked from alopresto/gpg_git_signing.md
Steps to enable GPG signing of git commits.

If anyone is interested in setting up their system to automatically (or manually) sign their git commits with their GPG key, here are the steps:

  1. Generate and add your key to GitHub
  2. $ git config --global commit.gpgsign true ([OPTIONAL] every commit will now be signed)
  3. $ git config --global user.signingkey ABCDEF01 (where ABCDEF01 is the fingerprint of the key to use)
  4. $ git config --global alias.logs "log --show-signature" (now available as $ git logs)
  5. $ git config --global alias.cis "commit -S" (optional if global signing is false)
  6. $ echo "Some content" >> example.txt
  7. $ git add example.txt
  8. $ git cis -m "This commit is signed by a GPG key." (regular commit will work if global signing is enabled)
@Kouni
Kouni / gitlab-admin-service-account.yaml
Created September 28, 2021 02:04
GitLab authenticates against Kubernetes using service tokens, which are scoped to a particular namespace. The token used should belong to a service account with cluster-admin privileges. To create this service account
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab-admin
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: gitlab-admin

Credit to MadHatter

WINDOWS

Use your text editor of choice or if you don't have one use Windows Notepad
Opening with Notepad may or may not result in a fancy mess

  1. Close Spotify
  2. Open File Explorer and paste the following into the address bar %appdata%/Spotify
  3. Open the file named prefs with your text editor
  4. Change the numeric value following storage.size= . If storage.size= doesn't exist add it manually to the end of the file and assign numeric value. This value represents megabytes. One gigabyte equals 1024 megabytes. In the end, it should look something like this storage.size=1024
  5. Save the file