curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ansible playbook to setup HTTPS using Let's encrypt on nginx. | |
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS. | |
The server pass A rating on [SSL Labs](https://www.ssllabs.com/). | |
To use: | |
1. Install [Ansible](https://www.ansible.com/) | |
2. Setup an Ubuntu 16.04 server accessible over ssh | |
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain | |
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder) |
Adapted from traefik systemd Service Unit
The provided file should work with systemd version 219 or later. It might work with earlier versions.
The easiest way to check your systemd version is to run systemctl --version
.
We will assume the following:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteRule ^([0-9]+)/(.*)$ index.php?castka=$1&msg=$2 [L] | |
RewriteRule ^([0-9]+)$ index.php?castka=$1% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: utf-8 | |
# http://musta.sh/2012-03-04/twisted-tcp-proxy.html | |
import sys | |
from twisted.internet import defer | |
from twisted.internet import protocol | |
from twisted.internet import reactor | |
from twisted.python import log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
import struct | |
####http://python-bitcoinlib.readthedocs.org/en/latest/_modules/bitcoin/core/serialize.html | |
def uint256_from_str(s): | |
"""Convert bytes to uint256""" | |
r = 0 | |
t = struct.unpack(b"<IIIIIIII", s[:32]) | |
for i in range(8): | |
r += t[i] << (i * 32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import update_wrapper | |
from django.contrib import admin | |
from django.contrib.admin import ModelAdmin | |
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters | |
from django.core.exceptions import PermissionDenied | |
from django.shortcuts import render | |
from myapp.models import Widget | |
from myapp.forms import ManageWidgetForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Mapping | |
from twisted.names import dns, server, client, cache | |
from twisted.application import service, internet | |
class MapResolver(client.Resolver): | |
def __init__(self, mapping, servers): | |
client.Resolver.__init__(self, servers=servers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://notmysock.org/blog/hacks/a-twisted-dns-story.html | |
# http://blog.inneoin.org/2009/11/i-used-twisted-to-create-dns-server.html | |
# twistd -y dns.py | |
import socket | |
from twisted.internet.protocol import Factory, Protocol | |
from twisted.internet import reactor | |
from twisted.names import dns | |
from twisted.names import client, server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ADD RULE with PORT and IPADDRESS | |
sudo iptables -A INPUT -p tcp -m tcp --dport port_number -s ip_address -j ACCEPT | |
ADD RULE for PORT on all addresses | |
sudo iptables -A INPUT -p tcp -m tcp --dport port_number --sport 1024:65535 -j ACCEPT | |
DROP IPADRESS | |
sudo iptables -I INPUT -s x.x.x.x -j DROP | |
VIEW IPTABLES with rule numbers |
NewerOlder