Skip to content

Instantly share code, notes, and snippets.

View yuswitayudi's full-sized avatar
🎯
Listening port . . . . .

Yudi Tata yuswitayudi

🎯
Listening port . . . . .
View GitHub Profile
@gabrielfeitosa
gabrielfeitosa / config.env
Created September 25, 2020 18:55
Blue/Green deployment (Traefik, docker)
ENVIRONMENT=dev
OTHER_CONFIG=BLAH
@mrclay
mrclay / flush-iptables.sh
Last active April 20, 2025 12:25
Flush IP tables and restart docker
#!/bin/bash
# Script is needed because my default firewall rules are messed up and after
# every restart, docker containers can't make connections to the host, notably
# preventing debuggers like xdebug from attaching.
# If networking fails in your containers but works in others, rm and re-create the
# docker network that container is bound to.
set -euo pipefail
@pujianto
pujianto / Search *.css and *.js and add brotli compression
Created September 25, 2019 05:23
Search all css & js files recursively and compress it with brotli. -Z mode = maximum compression
find . -type f -regextype posix-extended -regex '.*(css|js)$' -exec brotli -fZ {} \;
@nicks9188
nicks9188 / LC_CTYPE.md
Created May 6, 2019 13:51
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
  1. vi /etc/environment

add these lines...

LANG=en_US.utf-8
LC_ALL=en_US.utf-8

Alternatively,

@ufuk
ufuk / siege-post-json.sh
Last active April 14, 2023 16:37
Siege command to benchmark POST method with JSON payload and headers example. ("-c" for concurrent request count) ("-t" for time) ("-H" for header)
siege -c50 -t5S -H 'Content-Type: application/json' -H 'access-token: ...' 'http://localhost:8080/... POST {"...": "...", ...}'
@ugurerkan
ugurerkan / zimbra-letsencrypt-renew.md
Last active September 9, 2023 13:19
Zimbra 8.6.0 Letsencrypt SSL renew walkthrough.
@CrimsonGlory
CrimsonGlory / mongo-docker-swarm-mode.txt
Last active September 24, 2021 20:49
MongoDB sharding + Docker Swarm mode
Warnings:
* as 2017-02-24 (Docker version 1.13.1), swarm mode is not officially recommeded from production.
* There are a few bugs like swarm stop working when changing network. https://github.com/docker/docker/issues/29580
* Some kernel options (like ulimit) are still not supported on swarm when creating services https://github.com/docker/docker/issues/25209
* As 2018-09-24 docker swarm is very unstable and definitely not ready for production. Witch each new version of docker, swarm is more unstable than the previous one. I would strongly recommend avoid using swarm all together. (See issues https://github.com/moby/moby/issues/36696 and https://github.com/moby/moby/issues/37725 )
* 2021-09-10: this is an old gist with experimental configuration. Don't use this for production or anything relevant. Trust me. Also mongo versions are quite old. If you are just playing with mongo and docker swarm, go ahead.
Servers are server1 (mongos and configsrv), server2 (shard1), server3(shard2).
-----Step 1. Create swar
@dungmanh88
dungmanh88 / backup_collection_mongo.sh
Last active January 22, 2024 07:42
Dump multiple collections of a db in mongodb
#!/bin/bash
db=<db>
collection_list="<collection1> <collection2> <collection3>"
host=127.0.0.1
port=<port>
out_prefix=/Temp
for collection in $collection_list; do
echo $collection
out_dir="${out_prefix}/${db}_${collection}/"
@Shellbye
Shellbye / basic_squid3
Created February 9, 2015 08:28
squid3 basic authentication
# ref http://stackoverflow.com/questions/3297196/how-to-set-up-a-squid-proxy-with-basic-username-and-password-authentication
# first install apache:
# $ sudo apt-get install -y apache2-utils
# add these five lines to /etc/squid3/squid.conf
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid3/passwords
auth_param basic realm proxy
acl authenticated proxy_auth REQUIRED
http_access allow authenticated
http_port 3128 # or whatever you like
@panchicore
panchicore / bash
Created October 7, 2011 00:25
solve perl: warning: Setting locale failed.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~