Skip to content

Instantly share code, notes, and snippets.

View ralexandr's full-sized avatar
💭
You're never wrong to do the right thing

Alexander Radyushin ralexandr

💭
You're never wrong to do the right thing
View GitHub Profile
@zackad
zackad / nextjs.conf
Created July 1, 2020 10:39
NGINX server configuration for nextjs static generated site.
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
location ~ /.+ {
try_files $uri $uri.html $uri =404;
}
Config Option Value Description
maxmemory 70% of the system maxmemory should be 70 percent of the system so that it will not take all the resource of the server.
maxmemory-policy volatile-lru It adds a random key with an expiry time
loglevel notice Loglevel should be notice so that log will not take too much resource
timeout 300 There should be a timeout value as well in redis configuration which prevents redis from spending too much time on the connection. It closes the connection of the client if it is ideal for more than 300 seconds.
@naiieandrade
naiieandrade / emojis_unicode.md
Last active May 21, 2024 00:09
Unicode emojis for Telegram
emoji unicode emoji unicode
✒️ :black_nib: \U00002712 ✔️ :heavy_check_mark: \U00002714
✖️ :heavy_multiplication_x: \U00002716 ‼️ :bangbang: \U0000203C
✳️ :eight_spoked_asterisk: \U00002733 :sparkles: \U00002728
:grey_exclamation: \U00002755 ✴️ :eight_pointed_black_star: \U00002734
❄️ :snowflake: \U00002744 ❇️ :sparkle: \U00002747
:x: \U0000274c :negative_squared_cross_mark: \U0000274e
@merikan
merikan / Jenkinsfile
Last active May 21, 2024 08:52
Some Jenkinsfile examples
Some Jenkinsfile examples
@mvneves
mvneves / git-split.md
Created December 28, 2017 21:36
How to split a git repository into two different ones

How to split a git repository into two different ones

These are the steps to extract a directory from a git repository (with all its history commit), create a new repository from this directory, and optionally remove it from the original one.

To the ones that are here to copy-paste code, this is an example which removes the MODULE directory from REPO repository.

Step 1: Extract the directory from the git repository

Clone the original repository:

@dvlden
dvlden / ffmpeg.md
Last active May 14, 2024 14:25
Convert video files to MP4 through FFMPEG

This is my personal list of functions that I wrote for converting mov files to mp4!

Command Flags

Flag Options Description
-codec:a libfaac, libfdk_aac, libvorbis Audio Codec
-quality best, good, realtime Video Quality
-b:a 128k, 192k, 256k, 320k Audio Bitrate
-codec:v mpeg4, libx264, libvpx-vp9 Video Codec
@itbdw
itbdw / ip_whitelist.lua
Last active April 2, 2024 10:43 — forked from Ceelog/cloudSettings
Nginx Lua IP Whitelist Rule
-- a quick LUA access script for nginx to check IP addresses match an
-- `ip_whitelist` set in Redis, and if no match is found send a HTTP
-- 403 response or just a custom json instead.
--
-- allows for a common whitelist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- white an ip:
-- redis-cli SADD ip_whitelist 10.1.1.1

FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.


Effective Engineer - Notes

What's an Effective Engineer?

@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@kevana
kevana / mmmmCookies.hbs
Last active May 28, 2019 10:30
Part of Nginx config for cookie-based routing.
if ($http_cookie ~* (
{{~#each cookies~}}
{{~ this }}{{#unless @last}}|{{/unless}}
{{~/each~}}
)=Y) {
rewrite ^{{ ocpUrl }}$ {{ bcpUrl }} redirect;
}
if ($http_cookie !~* (
{{~#each cookies~}}
{{~ this }}{{#unless @last}}|{{/unless}}