Skip to content

Instantly share code, notes, and snippets.

#!/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 / 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
@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 / 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 / simple_python_datasource.py
Created April 29, 2020 08:51 — forked from linar-jether/simple_python_datasource.py
Grafana python datasource - using pandas for timeseries and table data. inspired by and compatible with the simple json datasource
from flask import Flask, request, jsonify, json, abort
from flask_cors import CORS, cross_origin
import pandas as pd
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
@malefs
malefs / can-id-png.md
Created June 3, 2020 10:35 — forked from agmangas/can-id-png.md
Relationship between CAN IDs and J1939 PGNs

CAN IDs & J1939 PGNs

Global PGN Example

Original CAN ID:

1    8    F    0    0    1    0    B
0001 1000 1111 0000 0000 0001 0000 1011
@malefs
malefs / README.md
Created July 8, 2020 13:34 — forked from willprice/README.md
Install OpenCV 4.1.2 for Raspberry Pi 3 or 4 (Raspbian Buster)

Install OpenCV 4.1.2 on Raspbian Buster

$ chmod +x *.sh
$ ./download-opencv.sh
$ ./install-deps.sh
$ ./build-opencv.sh
$ cd ~/opencv/opencv-4.1.2/build
$ sudo make install
#Script to install Opencv 3.4.4 with optmizations for raspberry pi that can increase performance up to 50%!
#install pre-requisites
sudo apt-get install build-essential checkinstall cmake pkg-config yasm git gfortran libjpeg-dev libjasper-dev libpng-dev libtiff5-dev libtiff-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2-dev libv4l-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libgtk2.0-dev libtbb-dev qt5-default libatlas-base-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils libprotobuf-dev protobuf-compiler libgoogle-glog-dev libgflags-dev libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
#add symlink for libv4l
sudo ln -s -f /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
#download and install Intel TBB precompiled for raspberry pi 2/3 b
git clone https://github.com/abhiTronix/TBB_Raspberry_pi.git
cd TBB_Raspberry_pi/
@malefs
malefs / InfluxDB_cheatsheet.md
Created September 9, 2020 14:45 — forked from tomazursic/InfluxDB_cheatsheet.md
InfluxDB cheatsheet

InfluxDB Cheatsheet

Connect to InfluxDB using the commandline:

$ influx

Create a database foo:

CREATE DATABASE foo
@malefs
malefs / README.md
Created September 30, 2020 19:21
Redis Pub/Sub with Python (notes for my collegue)

Redis Pub/Sub with Python

Overview:

  • Redis supports PUB/SUB
  • It supports pattern matching. Clients may subscribe to glob-style patterns in order to receive all the messages sent to channel names matching a given pattern.

Prerequisites

Assuming Fedora 23.