Skip to content

Instantly share code, notes, and snippets.

View latuminggi's full-sized avatar

Aprillio Latuminggi latuminggi

View GitHub Profile
@latuminggi
latuminggi / Informative Linux Terminal with Horizontal Separator
Last active November 4, 2023 03:51
Informative Linux Terminal with Horizontal Separator
### This bash script below has been tested on Oracle Linux 8
### Put these 3 lines in the bottom file of your ~/.bashrc
export SERVER_NAME="[MyServerName] "
export PS0='\[\e[1;33m\]└─ exec @ \D{%F %T%z} $(eval printf %.0s─ '{36..'"${COLUMNS:-$(tput cols)}"\}; echo)\[\e[m\]\n'
export PS1="\n\[\e[1;33m\]┌$(eval printf %.0s─ '{2..'"${COLUMNS:-$(tput cols)}"\}; echo)\n├─ \h ($(eval hostname -I|cut -f1 -d' ')) ${SERVER_NAME}@ \w\n├─ \[\e[1;36m\]\u \\$\[\e[m\] "
### Adjust env SERVER_NAME, save and execute command below
$ source ~/.bashrc
/*!
* HTML5 export buttons for Buttons and DataTables.
* 2016 SpryMedia Ltd - datatables.net/license
*
* FileSaver.js (1.3.3) - MIT license
* Copyright © 2016 Eli Grey - http://eligrey.com
*/
(function( factory ){
if ( typeof define === 'function' && define.amd ) {
@VirtuBox
VirtuBox / nginx-geoip-module.md
Last active January 24, 2024 08:44
How to configure GeoIP module for Nginx

Create a folder to store the databases :

mkdir -p /usr/share/GeoIP

Download Country IP database

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz
echo "auto_prepend_file=/opt/www/proxy.php" >> /etc/php5/cli/php.ini

cd ~/Downloads

wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb

dpkg -i zabbix-release_3.2-1+xenial_all.deb

apt-get update

should add /etc/apt/sources.list.d/zabbix.list

@morhekil
morhekil / nginx.conf
Created August 14, 2014 12:18
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
@denji
denji / nginx-tuning.md
Last active April 21, 2025 11:07
NGINX tuning for best performance

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.

@zupo
zupo / folder_splitter.py
Created June 24, 2013 12:56
Split a folder with many files into subfolders with N files. Usage: python folder_splitter.py path/to/target/folder
# -*- coding: utf-8 -*-
# @author: Peter Lamut
import argparse
import os
import shutil
N = 10 # the number of files in seach subfolder folder
@jrivero
jrivero / file_get_contents_curl.php
Last active February 21, 2024 11:30
Alternative for file_get_contents() using curl
<?php
// http://25labs.com/alternative-for-file_get_contents-using-curl/
function file_get_contents_curl($url, $retries=5)
{
$ua = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36';
if (extension_loaded('curl') === true)
{
@mugifly
mugifly / blink.css
Last active May 26, 2024 20:01
CSS Blink for Webkit and others. (Chrome, Safari, Firefox (Gecko), IE, ...) CSSで擬似的なblinkを再現する簡単なTips。