Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dkrusky
dkrusky / docker-install
Last active March 22, 2024 20:05
Docker install for Ubuntu 22.04 and up
#!/bin/bash
# deal with pre-requisites
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
# install public signature for docker repo and setup repo
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
@dkrusky
dkrusky / tar.gz.extractor.cs
Created July 27, 2022 16:13
Pure c# class to extract files from .tar.gz files in memory. Expects a byte array of the file to extract.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Threading.Tasks;
public class TarGzExtractor
{
@dkrusky
dkrusky / curl.inc.php
Created October 31, 2018 09:09
Ultimate curl wrapper
<?php
//abstract class curl {
class curl {
private $error_codes;
private $_headers;
private $_options;
public $headers;
@dkrusky
dkrusky / wp-config.php
Created December 22, 2018 00:23
Better WordPress Config (All customization's available)
<?php
/* Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') ) { define('ABSPATH', dirname(__FILE__) . '/'); }
/* Debug Mode */
error_reporting(E_ALL);
@ini_set('display_errors', false );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', false );
@dkrusky
dkrusky / autofill.js
Created September 12, 2020 14:38
Automatically fill out a webform UI with test data. (supports: select, text, checkbox, textarea, radio)
// tested with jQuery 3.x
$(document).ready(function(){
$("[name^=entry]").each(function(){
switch($(this).prop("type")) {
case "radio":
$(this).prop("checked", true);
break;
case "checkbox":
$(this).prop("checked", true);
break;
@dkrusky
dkrusky / pfx2pem.sh
Created August 20, 2020 16:31
Command line script to convert pfx with private key to pem format for Apache/nginx
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "
Command Syntax:
pfx2pem <cert> <optional:password>
"
@dkrusky
dkrusky / setup.sh
Last active August 18, 2020 13:59
Script to assist in post installation of minimal secure setup for Debian.
#!/bin/bash
# ************************************
# * SETTINGS *
# ************************************
FIREWALL_DYNDNS="";
FIREWALL_GEOIP_ACCOUNT="";
FIREWALL_GEOIP_LICENSE="";
# Set value to 1 to install that feature. Otherwise set to 0
@dkrusky
dkrusky / setup.sh
Created August 6, 2020 21:04
Debian post-install core configuration script with firewall, mysql, php, composer, and nvm.
#!/bin/bash
# ************************************
# * SETTINGS *
# ************************************
FIREWALL_DYNDNS="";
FIREWALL_GEOIP_ACCOUNT="";
FIREWALL_GEOIP_LICENSE="";
# Set value to 1 to install that feature. Otherwise set to 0
@dkrusky
dkrusky / install-and-secure-linux-with-csf.sh
Last active February 28, 2020 15:54
Consolidates CSF paramaters into a single script which will download any required runtimes for your distro, detect and enable ipv6 firewall, and install and configure CSF. Tested on Debian and CentOS.
#!/bin/sh
CSF="/etc/csf/csf.conf"
# set the values as you wish them to be set in the running version of csf
RESTRICT_UI='2'
RESTRICT_SYSLOG='3'
LF_SPI='1'
TCP_IN='25,80,110,443,465,587,995,2083'
TCP_OUT='20,21,22,25,37,43,53,80,110,113,443,587,873,993,995,2086,2087,2089,2703'
UDP_IN='33434:33523'