Skip to content

Instantly share code, notes, and snippets.

View Orfeous's full-sized avatar
💭
I may be slow to respond.

Gabor Racz Orfeous

💭
I may be slow to respond.
  • R.S. Ltd
  • Dublin
View GitHub Profile
@Orfeous
Orfeous / README.md
Created December 15, 2023 23:19 — forked from nomi-san/README.md
Appear offline on League Client

Guides

Run offlol.bat as administrator to appear offline, with any arg to appear online.

$ offlol.bat
Please run as administrator.

admin $ offlol.bat
You will appear offline on League Client.
@Orfeous
Orfeous / Self-Signed SSL with SAN.md
Created January 15, 2023 23:54 — forked from KeithYeh/Self-Signed SSL with SAN.md
Create self-signed SSL certificate with SubjectAltName(SAN)

How to create a self-signed SSL Certificate with SubjectAltName(SAN)

After Chrome 58, self-signed certificate without SAN is not valid anymore.

Step 1: Generate a Private Key

openssl genrsa -des3 -out example.com.key 2048

Step 2: Generate a CSR (Certificate Signing Request)

@Orfeous
Orfeous / 01nginx-tls-sni.md
Created September 29, 2022 21:58 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@Orfeous
Orfeous / self-update-script.py
Created September 20, 2021 10:42 — forked from gesquive/self-update-script.py
Stick this in a python script to self update the script from an online source
def update(dl_url, force_update=False):
"""
Attempts to download the update url in order to find if an update is needed.
If an update is needed, the current script is backed up and the update is
saved in its place.
"""
import urllib
import re
from subprocess import call
def compare_versions(vA, vB):
@Orfeous
Orfeous / SortedDictionaryExtensions.cs
Created September 16, 2021 12:34 — forked from R2D221/SortedDictionaryExtensions.cs
SortedDictionary extensions to mimic behaviour from Java NavigableMap
using System.Linq;
namespace System.Collections.Generic
{
// based on http://stackoverflow.com/a/3486820/1858296
public static class SortedDictionaryExtensions
{
private static Tuple<int, int> GetPossibleIndices<TKey, TValue>(SortedDictionary<TKey, TValue> dictionary, TKey key, bool strictlyDifferent, out List<TKey> list)
{
list = dictionary.Keys.ToList();
@Orfeous
Orfeous / PVE-host-backup.md
Created October 24, 2020 12:25 — forked from mrpeardotnet/PVE-host-backup.md
Proxmox PVE Host Config Backup Script

Proxmox PVE Host Config Backup Script

This script can be used to backup essential configuration files from the Proxmox Virtual Enivronment (PVE) host.

The script will create backups using tar with specified backup prefix and date and time stamp in the file name. Script will also delete backups that are older then number of days specified.

Create backup script file

To create backup script that will be executed every day we can create backup script in /etc/cron.daily/ folder. We need to make it writeable by root (creator) only, but readable and executable by everyone:

touch /etc/cron.daily/pvehost-backup
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@Orfeous
Orfeous / Jupyter2Python.py
Created August 27, 2019 23:10
Convert Jupyter notebooks to Python scripts without the need to install jupyter.
import sys,json
f = open(sys.argv[1], 'r', encoding="utf8") #input.ipynb
j = json.load(f)
of = open(sys.argv[2], 'w', encoding="utf8") #output.py
if j["nbformat"] >=4:
for i,cell in enumerate(j["cells"]):
of.write("#cell "+str(i)+"\n")
for line in cell["source"]:
of.write(line)
Generate ssl certificates with Subject Alt Names on OSX
=======================================================
Open `ssl.conf` in a text editor.
Edit the domain(s) listed under the `[alt_names]` section so that they match the local domain name you want to use for your project, e.g.
DNS.1 = my-project.dev
Additional FQDNs can be added if required:
@Orfeous
Orfeous / dirtyc0w.c
Created May 22, 2019 12:35
The Dirty COW exploit
/*
####################### dirtyc0w.c #######################
$ sudo -s
# echo this is not a test > foo
# chmod 0404 foo
$ ls -lah foo
-r-----r-- 1 root root 19 Oct 20 15:23 foo
$ cat foo
this is not a test
$ gcc -pthread dirtyc0w.c -o dirtyc0w