Skip to content

Instantly share code, notes, and snippets.

@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 / 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:8870916
Created February 7, 2014 20:18
Python 3 - env for Pyramid
python3.3 -m venv app-env
cd app-env/
source bin/activate
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
bin/easy_install pyramid
bin/pcreate -s alchemy app
cd app
python setup.py develop
cd ..
@solusipse
solusipse / gist:8961347
Created February 12, 2014 18:15
pyramid - HTTPFound get method
url = request.route_url('home', _query={'login': 'invalid'})
return HTTPFound(location=url)
@solusipse
solusipse / ytwebm.py
Last active August 29, 2015 14:00
Youtube to webm converter
'''
Sample usage:
python ytwebm.py https://www.youtube.com/watch?v=dQw4w9WgXcQ -s 01:45 -l 5
This will create webm file from youtube video from 01:45 to 01:50
'''
import youtube_dl, subprocess, os, argparse
class Downloader:
@solusipse
solusipse / raspberry-pi-wifi.md
Last active August 29, 2015 14:00
Getting wlan connecting on Arch fresh install (Raspberry Pi)

Raspberry Pi: wireless connection

This document will help you to establish wireless network connection without installing any programs and then, configure wicd that manages connections automatically.


Basic connection

List all net devices:

@solusipse
solusipse / raspberry-pi-arch-linux-xbmc.md
Created May 3, 2014 19:21
Arch Linux on Raspberry Pi: RPi as xbmc station

#Arch Linux on Raspberry Pi: RPi as xbmc station#

Let's start from creating xbmc user:

useradd -m -s /bin/bash xbmc

Install necessary packages:

pacman -Syu xorg xorg-xinit xbmc slim
@solusipse
solusipse / gist:e65fd40b9ab08049634c
Created June 12, 2014 23:15
Recovering Windows 8 OEM key on Linux
sudo cat /sys/firmware/acpi/tables/MSDM
@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:

dll and lib files from mingw:

rename libraryname.so to libraryname.dll

lib /machine:i386 /def:libraryname.def