Skip to content

Instantly share code, notes, and snippets.

@malefs
malefs / iptables_rules.sh
Created April 20, 2020 14:19 — forked from pirafrank/iptables_rules.sh
basic iptables rules
# iptables basic rules to use (in order)
# set default policy to drop
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
# enable ssh on port 22
iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
@malefs
malefs / rules.v4
Created April 20, 2020 14:16 — forked from feffi/rules.v4
/etc/iptables/rules.v4
# Generated by iptables-save v1.4.14 on Wed May 14 23:43:26 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# accept all loop traffic, discard all malicious localloop traffic
-A INPUT -i lo -j ACCEPT
-A INPUT -d 127.0.0.0/8 ! -i lo -j REJECT --reject-with icmp-port-unreachable
@malefs
malefs / ubuntu-server-setup.md
Created April 15, 2020 11:11 — forked from raikel/ubuntu-server-setup.md
Ubuntu server setup

Avoid ssh lost connection due to innactivity

On the server, edit the file /etc/ssh/sshd_config:

ClientAliveInterval 30
ClientAliveCountMax 10
#!/bin/bash
# Secure OpenVPN server installer for Debian, Ubuntu, CentOS and Arch Linux
# https://github.com/Angristan/OpenVPN-install
if [[ "$EUID" -ne 0 ]]; then
echo "Sorry, you need to run this as root"
exit 1
fi
@malefs
malefs / pyenv-cheat-sheet.md
Created April 14, 2020 13:36
pyenv cheat sheet

Python environment cheatsheet

Tool for creating isolated Python environments

The common use-cases:

  • Handling different versions of same libraries per each service
  • Same plus no access to site-packages
@malefs
malefs / Pacifica.ino
Created January 18, 2020 18:09 — forked from kriegsman/Pacifica.ino
Pacifica: gentle, blue-green ocean waves. For Dan.
//
// "Pacifica"
// Gentle, blue-green ocean waves.
// December 2019, Mark Kriegsman and Mary Corey March.
// For Dan.
//
#define FASTLED_ALLOW_INTERRUPTS 0
#include <FastLED.h>
FASTLED_USING_NAMESPACE
@malefs
malefs / obdii_info.sh
Created June 4, 2019 13:28 — forked from BretStateham/obdii_info.sh
Dump OBDII Info via cansend and candump
# --------- SCRIPT BEGIN ----------
# By Bret Stateham
# This script assumes
# - You are running on a linux machine
# - You have the can-utils installed and working. See:
# - https://github.com/linux-can/can-utils
# - https://www.kernel.org/doc/Documentation/networking/can.txt
# - You have a can device attached and configured as can0 (you can change the targetbus variable to match if otherwise)
# - The can device is attached to your running target vehicle
@malefs
malefs / message.hpp
Created April 18, 2019 10:26 — forked from mashiro/message.hpp
zeromq + msgpack
#include <string>
#include <ctime>
#include <msgpack.hpp>
struct message
{
std::string tag;
std::time_t time;
std::string text;
MSGPACK_DEFINE(tag, time, text);
@malefs
malefs / ffmpeg-mjpeg.sh
Last active March 28, 2019 07:59 — forked from indiejoseph/ffmpeg-mjpeg.sh
ffmpeg record mjpg-streamer
# capture mjpegstream -r Framerate
ffmpeg -f mjpeg -r 2 -i "http://127.0.0.1/rpicam/cam_pic_new.php?" -r 2 ./video.avi