Skip to content

Instantly share code, notes, and snippets.

The sun is behind every cloud

Fedir RYKHTIK fedir

The sun is behind every cloud
  • Stratis
  • Toulon, France
Block or report user

Report or block fedir

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
fedir /
Last active Oct 8, 2019
PDF compression with gs (works well on Linux Mint)
# Compressing to EBook quality (between "screen" and "preprocess")
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
# Black and white output, with custom resolution
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dCompressFonts=true -r150 -dNOPAUSE -dQUIET -dBATCH -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -sOutputFile=output.pdf input.pdf
fedir /
Last active Mar 28, 2019

Installation verification


$ wkhtmltopdf output.pdf
Loading pages (1/5)
Error: Failed loading page (sometimes it will work just to ignore this error with --ignore-load-errors)


fedir /
Last active Mar 21, 2019
Disk performance check with dd dsync (synchronized I/O for data)
# Small files (64KB)
dd if=/dev/zero of=./dsync64KB.img bs=64 count=1000 oflag=dsync 2>&1|tee dsync-test-1-64KB.log
# Medium files (8MB)
dd if=/dev/zero of=./dsync8MB.img bs=8k count=1000 oflag=dsync 2>&1|tee dsync-test-2-8MB.log
# Big files (128MB)
dd if=/dev/zero of=./dsync128MB.img bs=128k count=1000 oflag=dsync 2>&1|tee dsync-test-3-128MB.log
fedir / slice_filtering.go
Last active Mar 13, 2019
golang > the fastest version of a slice of structs filtering will be a recreation of new slice of structs
View slice_filtering.go
// ref.
y := x[:0]
for _, n := range x {
if !=42 {
y = append(y, n)
// If some further sorting should be done, requires Go 1.8+
fedir /
Last active Mar 8, 2019
Go > ImageMagick & JPG2PDF on Debian / Ubuntu

Go > ImageMagick & JPG2PDF on Debian / Ubuntu


sudo apt-get install libmagickwand-dev
go get -u

Additional ressources

fedir /
Created Mar 8, 2019
Fix MySQL "[ERROR] Error in accept: Too many open files" on start on Debian

Fix MySQL "[ERROR] Error in accept: Too many open files" on start

Check system limtis

cat /proc/$(cat /var/run/mysqld/

Update system limits

$ vim /etc/security/limits.conf
fedir /
Created Mar 7, 2019
iptables routes port 80 to 4000

iptables port routing from 80 to 4000


Route via iptables

$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 4000

Make it persistent (on Debian, Ubuntu)

fedir / argon2i.php
Last active Feb 21, 2019
PHP Argon2i test
View argon2i.php
ini_set('display_errors', 1);
echo password_hash("test", PASSWORD_ARGON2I) . "\n";
// expected output:
// $argon2i$v=19$m=1024,t=2,p=2$Si9YUTV5Mk50clRPckJmNg$iiaHUvfJpx2fwVJLUDr2J0XePR31gxxIu5VHlgFMA/k
git clone
cd kubernetes-engine-samples/hello-app
cat main.go
cat Dockerfile
gcloud container clusters get-credentials <;cluster-name> \
gcloud container clusters get-credentials cluster-1 --zone europe-west1
docker build -t $PWD
gcloud docker -- push
kubectl run hello-node --port=8080
kubectl expose deployment hello-node --type="LoadBalancer"

Open Weather API call

Installation procedure

  • Create scripts
  • Define CITY_ID and APP_ID in each script
  • Add scritps into the crontab


You can’t perform that action at this time.