Skip to content

Instantly share code, notes, and snippets.

View apio-sys's full-sized avatar
🏠
Working from home

Joris Le Blansch apio-sys

🏠
Working from home
View GitHub Profile
@dublado
dublado / clock.css
Created April 19, 2021 01:44 — forked from Ultrabenosaurus/clock.css
CSS Animations clock with seconds, minutes and hours
.loader{
color: #555;
font-family: sans-serif;
font-size: 3em;
text-align: center;
-webkit-border-radius: 50%;
border-radius: 50%;
border: 5px solid #555;
width:100px;
height:100px;
@sambeirne
sambeirne / deploy.md
Last active January 18, 2024 12:55
Deploy a Python WebSocket Server on Debian 10 ("buster") with systemd and nginx

Deploy a Python WebSocket Server on Debian 10 ("buster") with systemd and nginx

Following are configuration files and instructions for using systemd to create Unix domain sockets to handle incoming websocket requests. Websocket requests are proxied by nginx.

While these instructions are for Debian 10, they should largely work on other Linux distributions. It may be necessary to change paths and the nginx username, which is www-data when installed with the Debian package manager.

Install requirements

user@host:~$ sudo apt update
user@host:~$ sudo apt install nginx python3 wget
@anatolebeuzon
anatolebeuzon / 20auto-upgrades
Last active March 24, 2024 08:21
Unattended-upgrades config for Raspberry Pi running Raspbian
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "3";
APT::Periodic::Verbose "1";
APT::Periodic::Unattended-Upgrade "1";

Centralize Fail2Ban

Warding potential server attacks with a centralized Fail2Ban

System Requirements

This HowTo assumes that fail2ban, iptables, mysql and php is installed functional on the system. On Ubuntu, you can quickly do:

root@devserv3:~# sudo apt-get install php5 mysql-server fail2ban iptables
@dvlop
dvlop / gist:fca36213ad6237891609e1e038a3bbc1
Last active May 3, 2024 16:43 — forked from allthingsdem/gist:63b3223a7d14ac1f2457
My long list of bad bots to block in htaccess, ready to copy and paste!
# Start Bad Bot Prevention
<IfModule mod_setenvif.c>
# SetEnvIfNoCase User-Agent ^$ bad_bot
SetEnvIfNoCase User-Agent "^12soso.*" bad_bot
SetEnvIfNoCase User-Agent "^192.comAgent.*" bad_bot
SetEnvIfNoCase User-Agent "^1Noonbot.*" bad_bot
SetEnvIfNoCase User-Agent "^1on1searchBot.*" bad_bot
SetEnvIfNoCase User-Agent "^3D_SEARCH.*" bad_bot
SetEnvIfNoCase User-Agent "^3DE_SEARCH2.*" bad_bot
SetEnvIfNoCase User-Agent "^3GSE.*" bad_bot
@chuckreynolds
chuckreynolds / antispambot-wordpress-shortcode.php
Created April 26, 2017 22:43
Antispambot WordPress shortcode function
<?php
/**
* Hide email from Spam Bots using a shortcode.
* Anti-Spambot Email Shortcode, v1.1.1
* https://wordpress.org/plugins/antispambot
*
* @param array $atts Shortcode attributes. Not used.
* @param string $content The shortcode content. Should be an email address.
*
* @return string The obfuscated email address.

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1