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 / install-mapnik-amazon-ami.sh
Last active August 29, 2015 14:27 — forked from springmeyer/install-mapnik-amazon-ami.sh
Mapnik on Amazon Linux AMI (Fedora)
# http://aws.amazon.com/amazon-linux-ami/
# http://aws.amazon.com/amazon-linux-ami/faqs/
# Boot up a machine with at least 1.5 to 2 GB Ram
# login
chmod 600 key.pem
ssh -i key.pem ec2-user@ec2...compute.amazonaws.com
# update
@Orfeous
Orfeous / XSSRequestWrapper.java
Created December 11, 2015 13:00 — forked from madoke/XSSRequestWrapper.java
Stronger Anti Cross-Site Scripting (XSS) Filter for Java Web Apps
package pt.impresa.iweb.filters.request;
import java.io.IOException;
import java.text.Normalizer;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
@Orfeous
Orfeous / index.php
Created August 12, 2016 09:58 — forked from ziadoz/index.php
Simple PHP / jQuery CSRF Protection
<?php
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html
// Start a session (which should use cookies over HTTP only).
session_start();
// Create a new CSRF token.
if (! isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32));
}

Keybase proof

I hereby claim:

  • I am Orfeous on github.
  • I am orfeous (https://keybase.io/orfeous) on keybase.
  • I have a public key whose fingerprint is 3AEE 4584 86CA CDDE 9418 F34F C23A 2035 0078 22E1

To claim this, I am signing this object:

@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
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 / 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)
# 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 / 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
@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();