Skip to content

Instantly share code, notes, and snippets.

@solusipse
solusipse / 01_postfix_installer.md
Last active October 25, 2023 20:34
Postfix + Dovecot + Postgresql + Postfixadmin + Roundcube

Postfix Installer

Following script may be used for configuring complete and secure email server on fresh install of Debian 7. It will probably work on other distributions using apt-get. After minor changes you'll be able to use it on other Linux distros.

Usage

  1. Run postfix.sh script.
  2. Configure postgres to allow connections.
  3. Configure postfix admin. Remember to set these:
@solusipse
solusipse / echo.py
Last active December 15, 2020 01:39
Simple echo server written in pure Python
# Example of simple echo server
# www.solusipse.net
import socket
def listen():
connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
connection.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
connection.bind(('0.0.0.0', 5555))
connection.listen(10)
@solusipse
solusipse / gist:e65fd40b9ab08049634c
Created June 12, 2014 23:15
Recovering Windows 8 OEM key on Linux
sudo cat /sys/firmware/acpi/tables/MSDM
# This is a very simple script for performing whole disk backups. Rotation scheme: 3 daily backups, 2 weekly and 2 monthly.
# Edit to suit your needs. The only non-standard requirement is sshfs.
TARGET="1.1.1.1"
MAIL="my@mail.com"
sshfs root@$TARGET:/backup/disk /root/mnt
if [ $# -eq 0 ]; then
echo "Run with argument: daily, weekly or monthly."
exit
@solusipse
solusipse / crontab
Created March 21, 2016 12:19
Simple backup solution - rsnapshot
# on backup server
0 */4 * * * /usr/bin/rsnapshot hourly
30 3 * * * /usr/bin/rsnapshot daily
0 3 * * 1 /usr/bin/rsnapshot weekly
30 2 1 * * /usr/bin/rsnapshot monthly
@solusipse
solusipse / pgsql_backup.sh
Created January 9, 2016 09:53
postgresql backup
#!/bin/bash
# remember to set local to trust in pg_hba.conf
sudo -u postgres pg_dumpall | gzip -c > /backup/db.sql
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "Database backup failed at domain.com!" | mail -s "Backup error" your@address.com
fi
chmod 0600 /backup/db.sql
date > /backup/last.txt
@solusipse
solusipse / echo.c
Created September 3, 2013 16:02
Simple echo server written in C
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <pthread.h>
@solusipse
solusipse / gist:b3a13e6578d97db97c27
Created October 6, 2015 03:50
esp8266 exception codes
Cause code Name
0 IllegalInstructionCause
1 SyscallCause
2 InstructionFetchErrorCause
3 LoadStoreErrorCause
4 Level1InterruptCause
5 AllocaCause
6 IntegerDivideByZeroCause
7
@solusipse
solusipse / esp8266-connect-to-ap.md
Created August 12, 2015 09:19
ESP8266: connect to access point
AT
AT+CWMODE=1
AT+CWLAP # scan for wireless networks
AT+CWJAP="ssid","password"
AT+CWJAP? # check if connected
AT+CIFSR # get ip

Rasbperry PI DS18b20 in parasitic mode (2 wires only)

Add to /boot/config.txt following line:

dtoverlay=w1-gpio,gpiopin=4,pullup=on