Skip to content

Instantly share code, notes, and snippets.

@dcnl1980
dcnl1980 / nginx-tls.conf
Last active June 13, 2016 12:23
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Chris van Steenbergen <cvsteenbergen@gmail.com>
# Date: 13 June 2016
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are omitted here.
#
# Preparation: Strong 4096 bits DHE parameters (takes time)
@dcnl1980
dcnl1980 / create-slugs.php
Created August 6, 2016 14:40
Create Slugs in large MYSQL tables
<?php
// This script must be run on a command line
error_reporting(E_ALL);
set_time_limit(1200);
date_default_timezone_set("Europe/Amsterdam");
$mysqli = new mysqli('localhost', 'username', 'password', 'table');
if ($mysqli->connect_error) {
@dcnl1980
dcnl1980 / naxsi_core.rules
Created November 29, 2016 08:45
Naxsi Rules Conf
##################################
## INTERNAL RULES IDS:1-999 ##
##################################
#@MainRule "msg:weird request, unable to parse" id:1;
#@MainRule "msg:request too big, stored on disk and not parsed" id:2;
#@MainRule "msg:invalid hex encoding, null bytes" id:10;
#@MainRule "msg:unknown content-type" id:11;
#@MainRule "msg:invalid formatted url" id:12;
#@MainRule "msg:invalid POST format" id:13;
#@MainRule "msg:invalid POST boundary" id:14;
@dcnl1980
dcnl1980 / backup-linux.sh
Last active November 29, 2016 12:50
Linux backup script
#/bin/sh
# This file is under construction and will be update regulary, so it can be a cron-shell for backing up Linux based systems.
# put this in the cronjob to run the backup every day at 2:15
# 15 2 * * * /var/backups/backup.sh
current="$(date +'%d_%m_%Y_%H_%M_%S')"
# MYSQL BACKUP
sudo mysqldump -u root -pPASSWORD --all-databases | gzip > /var/backups/dbbackup_$current.sql.gz
# WEBSITES BACKUP
sudo tar czf /var/backups/sitebackup_$current.tar -C / var/www && gzip /var/backups/sitebackup_$current.tar
# DELETE OLD BACKUPS > 7 days
@dcnl1980
dcnl1980 / build-nginx-naxsi.sh
Created December 20, 2016 15:51
Build the latest Nginx with NAXSI
#!/usr/bin/env bash
apt-get install -y libpcre3 libpcre3-dev libssl-dev unzip make \
libgoogle-perftools-dev google-perftools jq
mkdir /tmp/ngxbuild
cd /tmp/ngxbuild
latestNginx=$(curl -s http://hg.nginx.org/nginx/tags |
grep "^ *release-" | head -1 | cut -c 9-)
latestNaxsi=$(curl -s https://api.github.com/repos/nbs-system/naxsi/releases |
jq -r .[].tag_name | grep -v rc | head -1)
@dcnl1980
dcnl1980 / nginx-add-virtualhost.sh
Created December 27, 2016 21:51
Creating NGINX virtualhost
#!/bin/bash
# Modify the following to match your system
NGINX_CONFIG='/etc/nginx/sites-available'
NGINX_SITES_ENABLED='/etc/nginx/sites-enabled'
PHP_INI_DIR='/etc/php5/fpm/pool.d'
WEB_SERVER_GROUP='www-data'
NGINX_INIT='/etc/init.d/nginx'
PHP_FPM_INIT='/etc/init.d/php5-fpm'
# --------------END
@dcnl1980
dcnl1980 / letsupdate
Created January 24, 2017 10:03 — forked from philcryer/letsupdate
auto renewal script for Let's Encrypt
#!/bin/bash
#
# this is going to be a rewrite of this:
# https://github.com/defsdoor/letsencrypt-autorenew/blob/master/get_certificates
# example file mycerts:
## EMAIL admin@example.com
## HOSTS www.example.com
## EMAIL admin@mail.example.com
@dcnl1980
dcnl1980 / NOTES.md
Created January 2, 2017 21:41 — forked from DenisIzmaylov/NOTES.md
Step By Step Guide to Configure a CoreOS Cluster From Scratch

Step By Step Guide to Configure a CoreOS Cluster From Scratch

This guide describes how to bootstrap new Production Core OS Cluster as High Availability Service in a 15 minutes with using etcd2, Fleet, Flannel, Confd, Nginx Balancer and Docker.

Content

@dcnl1980
dcnl1980 / TOOLS.MD
Last active April 18, 2020 14:06
Install of blockchains

------- MAKE A SYMBOLIC LINK AFTER COMPILE OR INSTALL ----------

ln -s ~/bitcoin/bin/* /usr/local/bin

------- SETUP A DAEMON SERVICE ----------

sudo vi /etc/systemd/system/bitcoind.service

[Unit]
Description=bitcoin
After=network.target
@dcnl1980
dcnl1980 / hipchat-server.sh
Created November 28, 2016 21:59
Install the HipChat Server
sudo su
echo "deb http://downloads.hipchat.com/linux/apt stable main" > /etc/apt/sources.list.d/atlassian-hipchat.list
wget -O - https://www.hipchat.com/keys/hipchat-linux.key | apt-key add -
apt-get update
apt-get install hipchat