Skip to content

Instantly share code, notes, and snippets.

View hellresistor's full-sized avatar
💭
I may be slow to respond.

hellresistor hellresistor

💭
I may be slow to respond.
View GitHub Profile
@jirutka
jirutka / rules-both.iptables
Created September 18, 2012 12:42
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <[email protected]>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@reikind
reikind / gist:4072830
Created November 14, 2012 15:39
Example bash getopts
#!/bin/bash
usage() {
cat << EOT
usage $0 [-hgw]
$0 -m MESSAGE
OPTIONS
@jokey2k
jokey2k / sshfilter.sh
Last active April 22, 2024 14:18
Tuned version of sshfilter.sh to allow for ipv6 filtering
#!/bin/bash
# based on script from http://www.axllent.org/docs/view/ssh-geoip
# License: WTFPL
# UPPERCASE space-separated country codes to ACCEPT
ALLOW_COUNTRIES="DE EU GB"
LOGDENY_FACILITY="authpriv.notice"
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` <ip>" 1>&2
@Tristor
Tristor / sshd_config
Last active August 23, 2020 12:03
Hardened SSH Server Config 03/2016
# TCP port to bind to
# Change to a high/odd port if this server is exposed to the internet directly
Port 22
# Bind to all interfaces (change to specific interface if needed)
ListenAddress 0.0.0.0
# Force SSHv2 Protocol
Protocol 2
@mattia-beta
mattia-beta / ddos.conf
Last active November 14, 2024 09:20
IPtables DDoS Protection for VPS
### 1: Drop invalid packets ###
/sbin/iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
### 2: Drop TCP packets that are new and are not SYN ###
/sbin/iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
### 3: Drop SYN packets with suspicious MSS value ###
/sbin/iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
### 4: Block packets with bogus TCP flags ###
@nwaywood
nwaywood / bash-menu.sh
Created March 15, 2017 03:47
Template structure for a bash script with simple menu and command line args
#! /bin/bash
# ===================
# Script funtionality
# ===================
# do something
doSomething() {
echo 'doing something'
}
@tanaikech
tanaikech / submit.md
Created June 15, 2017 04:57
Embedding Animation GIF in A Cell on Spreadsheet

Embedding Animation GIF in A Cell on Spreadsheet

This sample script is for embedding animation GIF in a cell using custom function on Spreadsheet.

I think that this method is one of various ideas.

Problem

There are some limitations.

  1. Images of jpeg and png can be embedded in a cell using =IMAGE(). But when animation GIF is embedded using it, GIF is not played.
@voluntas
voluntas / sysctl.conf
Created October 14, 2017 13:07 — forked from techgaun/sysctl.conf
Sysctl configuration for high performance
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
@realslacker
realslacker / autoupdate.sh
Last active March 25, 2020 07:02
Ubuntu Auto-Update Script
#!/bin/bash
# to install directly from the Gist
# curl https://gist.githubusercontent.com/realslacker/6dce254e16003fbec5451689c9ba1e49/raw/ | bash -s -- -i
# test getopt
getopt --test > /dev/null
if [[ $? -ne 4 ]]; then
echo "Error: `getopt --test` failed in this environment, please update to a newer 'getopt' package"
exit 1