Skip to content

Instantly share code, notes, and snippets.

View gpproton's full-sized avatar

Grayscale Pacifista gpproton

View GitHub Profile

It seems that it does not matter what timezone is on the server as long as you have the time set right for the current timezone, know the timezone of the datetime columns that you store, and are aware of the issues with daylight savings time.

On the other hand if you have control of the timezones of the servers you work with then you can have everything set to UTC internally and never worry about timezones and DST.

Here are some notes I collected of how to work with timezones as a form of cheatsheet for myself and others which might influence what timezone the person will choose for his/her server and how he/she will store date and time.

MySQL Timezone Cheatsheet

@gpproton
gpproton / kannel.conf
Created October 17, 2018 23:26 — forked from srugano/kannel.conf
Example of Kannel configurations to be used with a Huawei modem.
# CONFIGURATION FOR USING SMS KANNEL WITH RAPIDSMS
#
# For any modifications to this file, see Kannel User Guide
# If that does not help, see Kannel web page (http://www.kannel.org) and
# various online help and mailing list archives
#
# Notes on those who base their configuration on this:
# 1) check security issues! (allowed IPs, passwords and ports)
# 2) groups cannot have empty rows inside them!
# 3) read the user guide
@gpproton
gpproton / example.php
Last active March 29, 2019 12:04 — forked from dunglas/example.php
A minimalist GraphQL client for PHP
<?php
$query = <<<'GRAPHQL'
query GetUser($user: String!) {
user (login: $user) {
name
email
repositoriesContributedTo {
totalCount
}
@gpproton
gpproton / nginx-directives-ispconfig
Created February 13, 2019 19:08 — forked from denvers/nginx-directives-ispconfig
Nginx directives for use in ISPConfig - Nginx PHP7 FPM
# Force non-www to www redirect
if ($host !~* ^www\.) {
rewrite ^(.*)$ $scheme://www.$host$1 permanent;
}
# Turn on SSL
# protip: https://mozilla.github.io/server-side-tls/ssl-config-generator/
ssl on;
add_header Strict-Transport-Security max-age=15768000;
stream {
log_format basic '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time';
access_log /var/log/nginx/access.log basic;
error_log /var/log/nginx/error.log debug;
include /etc/nginx/stream.conf.d/*.conf;
@gpproton
gpproton / nodejs-tcp-example.js
Created August 23, 2019 00:07 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@gpproton
gpproton / download_ext6.2.0.md
Created April 16, 2020 05:07 — forked from danielquisbert/download_ext6.2.0.md
Download extJS gpl 6.2
@gpproton
gpproton / macosx-install-php-oracle-oci8-pdo_oci.md
Created September 12, 2020 18:22 — forked from krisanalfa/macosx-install-php-oracle-oci8-pdo_oci.md
Install OCI8 and / or PDO_OCI on OSX via Brew

Installation

This procedure is tested on Mac OS X 10.10.5 with Developpers tools installed (xCode).

PHP 5.6 installed with Homebrew.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):

@gpproton
gpproton / filter.d_nginx-auth.conf
Created October 27, 2020 11:32 — forked from dunguyenn/filter.d_nginx-auth.conf
Fail2ban Config with Nginx and SSH
#
# Auth filter /etc/fail2ban/filter.d/nginx-auth.conf:
#
# Blocks IPs that makes too much accesses to the server
#
[Definition]
failregex = ^<HOST> -.*"(GET|POST).*HTTP.*"
ignoreregex =

It's true that swapoff -a is a silver bullet in most cases, however, certain k8s setups may really require swap. For instance, I've got a very small and cheap VM with just 1GB RAM, which I use for a personal GitLab Runner that rarely handles short CI/CD tasks. If I increase the size of the machine, I'll be paying more for a resource that's 99% idle. If I disable swap, npm install and other scripts inside the buid pods may hang because they require quite a lot of memory, although for short periods of time. Thus, a single-node kubeadm cluster with gitlab runner chart and swap is what suits me best.

Here is how I could get my mini-cluster up and running:

kubeadm reset 

## ↓ see explanation below
sed -i '9s/^/Environment="KUBELET_EXTRA_ARGS=--fail-swap-on=false"\n/' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf