Skip to content

Instantly share code, notes, and snippets.

@cho0o0
cho0o0 / generateAccesskey.js
Last active March 13, 2025 06:48
Generate Outline access key based on Shadowsocks infomation
const generateAccesskey = (method, password, ip, port) => {
const firstPart = btoa(`${method.toLowerCase()}:${password}`)
const secondPart = `${ip}:${port}`
const accesskey = `ss://${firstPart}@${secondPart}`
return accesskey
}
@bmatthewshea
bmatthewshea / - postfix-geoip.pl
Last active August 16, 2025 01:19
Postfix GeoIP Blocking
#!/usr/bin/perl
# Brady Shea Feb 25 2019
# starting point:
# http://web.archive.org/web/20151128083440/https://www.kutukupret.com/2011/05/29/postfix-geoip-based-rejections/
use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);
use Geo::IP;
use Regexp::Common;
@capslocky
capslocky / dns.sh
Last active August 27, 2020 03:39
Compare answers and query time of different public DNS
#!/bin/bash
# Compare answers and query time of different public DNS
# https://gist.github.com/capslocky/486c72e1ca59a204fa55fdebf221595f/
dns_names=()
dns_ips=()
add_dns(){
dns_names+=("$1")
dns_ips+=("${2:-ip not set}")
@alirezastack
alirezastack / backup_redis_rdb.sh
Last active April 24, 2024 08:11
Backup Redis RDB file - BASH Script
#!/bin/bash
#
## redis backup script
## usage
## redis-backup.sh port backup.dir
## Redis is very data backup friendly since you can copy RDB files while the database is running: the RDB is never modified once produced, and while it gets produced it uses a temporary name and is renamed into its final destination atomically using rename(2) only when the new snapshot is complete.
# Scripts & Files
rdb="/var/spool/alohi/storage/redis/dump.rdb"
@rohankhudedev
rohankhudedev / opcache.ini
Last active August 31, 2025 08:12
Best Zend OpCache Settings / Tuning / Configurations
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=512
@bmaupin
bmaupin / UnlimitedJCEPolicyJDK8-RHEL.sh
Last active November 4, 2022 02:57
Install jce_policy-8.zip on RHEL/CentOS 6/7
# See here for JDK 7: https://gist.github.com/bmaupin/4396be4bb29c5ad440b6
# See here for test to make sure this works: https://gist.github.com/evaryont/6786915
if grep -q -i "release 6" /etc/*release; then
jce_primary_link_dir=/usr/lib/jvm/jre-1.8.0-oracle.x86_64/lib/security
elif grep -q -i "release 7" /etc/*release; then
jce_primary_link_dir=/usr/lib/jvm/jce-1.8.0-oracle
fi
wget \
@noromanba
noromanba / apt-daily-timer-disable.md
Created December 25, 2016 17:51
how to disable apt-daily.timer

how to disable apt-daily.timer

$ systemctl stop apt-daily.timer
$ systemctl disable apt-daily.timer
$ systemctl mask apt-daily.service
$ systemctl daemon-reload

check current status

@moneytoo
moneytoo / gist:8c95cc39fd4fd9a18858eb15e379d2f5
Last active June 21, 2022 09:29
ImageMagick 6.7.8 with WebP (libwebp) support on CentOS 7
yum -y install bzip2-devel libtiff-devel giflib-devel ghostscript-devel libwmf-devel jasper-devel libtool-ltdl-devel libXext-devel libXt-devel librsvg2-devel OpenEXR-devel libwebp-devel
rpm -ivh http://vault.centos.org/centos/7/updates/Source/SPackages/ImageMagick-6.7.8.9-15.el7_2.src.rpm
sed -i '/BuildRequires:\tghostscript-devel/a BuildRequires:\tlibwebp-devel' /root/rpmbuild/SPECS/ImageMagick.spec
sed -i '/Requires: pkgconfig/a Requires: libwebp' /root/rpmbuild/SPECS/ImageMagick.spec
rpmbuild -ba /root/rpmbuild/SPECS/ImageMagick.spec
# actual install
rpm -Uvh --force /root/rpmbuild/RPMS/x86_64/ImageMagick-6.7.8.9-15.el7.centos.x86_64.rpm
@enrique-fernandez-polo
enrique-fernandez-polo / install_jdk_8_with_jce.sh
Created September 20, 2016 08:25
Download Java JDK 8 and install JCE
wget -q -N --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jdk-8u101-linux-x64.tar.gz" -O jdk-8u101-linux-x64.tar.gz
tar -xf jdk-8u101-linux-x64.tar.gz
wget -q -N --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jce/8/jce_policy-8.zip" -O jce_policy-8.zip
unzip -qo jce_policy-8.zip
rm -rf jdk1.8.0_101/jre/lib/security/local_policy.jar
rm -rf jdk1.8.0_101/jre/lib/security/US_export_policy.jar
@swarad07
swarad07 / PHP 5.2.17
Last active October 20, 2021 07:25
Script to compile php 5.2.17 from source, can be used with Vagrant
echo "### PROVISIONIN PHP 5.2.17..."
if [ "$(whoami)" != "root" ]
then
sudo su -s "$0"
exit
fi
# Add PostgreSQL Apt Repository (provides postgresql-server-dev-9.4)
echo "### Installing wget and other dependencies"
apt-get install -y wget
echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list