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:
# 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 |
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; |
<?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)); | |
} |
I hereby claim:
To claim this, I am signing this object:
/* | |
####################### 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: |
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 |
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.
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
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(); |