Skip to content

Instantly share code, notes, and snippets.

View szepnapot's full-sized avatar

Peter Lodri szepnapot

View GitHub Profile
@szepnapot
szepnapot / .py
Created May 20, 2017 23:07
Write text to image
import sys
import os
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
workdir = os.path.dirname(os.path.abspath(__file__))
text = ' '.join(sys.argv[1:])
print(text)
@szepnapot
szepnapot / dummy-web-server.py
Created December 15, 2017 14:58 — forked from bradmontgomery/dummy-web-server.py
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/usr/bin/env python
"""
Very simple HTTP server in python.
Usage::
./dummy-web-server.py [<port>]
Send a GET request::
curl http://localhost
@szepnapot
szepnapot / example.py
Created December 18, 2017 10:47 — forked from thom-nic/example.py
Handler for authenticating HTTPS connections with urllib2. (Python 2.x) Note that the 'ciphers' option in ssl.wrap_socket is python 2.7 only.
import logging, urllib2
import https
client_cert_key = None # file path
client_cert_pem = None #file path
ca_certs = None # file path
handlers = []
handlers.append( HTTPSClientAuthHandler(
@szepnapot
szepnapot / init.md
Last active March 25, 2018 16:32
Node + NPM installation guide
@szepnapot
szepnapot / install-redis.sh
Created August 14, 2018 14:52 — forked from khelll/install-redis.sh
Installing Redis on Amazon Linux
#!/bin/bash
###############################################
# To use:
# chmod +x install-redis.sh
# ./install-redis.sh
###############################################
version=3.2.0
echo "*****************************************"
echo " 1. Prerequisites: Install updates, set time zones, install GCC and make"
@szepnapot
szepnapot / install_python37.sh
Created September 6, 2018 17:20
Install Python 3.7 with Black on Ubuntu 16.04
# Install requirements
apt-get install -y build-essential
apt-get install -y checkinstall
apt-get install -y libreadline-gplv2-dev
apt-get install -y libncursesw5-dev
apt-get install -y libssl-dev
apt-get install -y libsqlite3-dev
apt-get install -y tk-dev
apt-get install -y libgdbm-dev
apt-get install -y libc6-dev
@szepnapot
szepnapot / ubuntu_server_setup.sh
Created November 24, 2018 15:47
Basic setup for EC2 instance running Ubuntu 18.04LTS
# add PHP+Certbot repo
add-apt-repository ppa:certbot/certbot -y
apt-add-repository ppa:ondrej/php -y
# update + upgrade
DEBIAN_FRONTEND=noninteractive apt-get -yq update && apt-get -yq upgrade
# set time + locale
timedatectl set-timezone Europe/Budapest
locale-gen en_US en_US.UTF-8
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
# enable auto-update
readonly CHAT_HOME=/opt/Rocket.Chat
readonly DOMAIN=[FILL-ME]
readonly WEBMASTER_MAIL=[FILL-ME]
# MongoDB
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
# Node.js
apt-get update -yq && apt-get install -yq curl && curl -sL curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
# Install deps
apt-get install -yq build-essential mongodb-org nodejs graphicsmagick
@szepnapot
szepnapot / ubuntu_docker_install.sh
Last active December 2, 2018 11:34
How To Install and Use Docker on Ubuntu 18.04
#!/bin/bash
# check for root first
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# update local packages
apt update
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/personality.h>
#include <sys/utsname.h>
#define UNAME26 0x0020000