Skip to content

Instantly share code, notes, and snippets.

// Some code that was written but never used for a project, keeping here as a reference for basic tree implementaiton in rust
#[derive(Debug, Default)]
struct FileTreeNode {
id: usize,
path: PathBuf,
parent: usize,
children: Vec<usize>,
}
@rminderhoud
rminderhoud / powershell-web-server.ps1
Last active December 1, 2023 14:54 — forked from 19WAS85/powershell-web-server.ps1
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@rminderhoud
rminderhoud / upload.py
Last active July 27, 2017 01:06
Flask basic upload
""" Basic file upload example for Flask
Example provided for spitfiredd on thread
https://www.reddit.com/r/flask/comments/5zen73/help_looking_to_create_a_simple_web_app_where_i/?ref=share&ref_source=link
"""
from flask import Flask, request, render_template, send_file
app = Flask(__name__)
# We need a secret key to work with form data
[ 32906.411]
X.Org X Server 1.15.1
Release Date: 2014-04-13
[ 32906.411] X Protocol Version 11, Revision 0
[ 32906.411] Build Operating System: Linux 3.2.0-76-generic x86_64 Ubuntu
[ 32906.411] Current Operating System: Linux Ralph-Desktop 3.16.0-38-generic #52~14.04.1-Ubuntu SMP Fri May 8 09:43:57 UTC 2015 x86_64
[ 32906.411] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.16.0-38-generic root=UUID=8b418cce-1e54-4be1-8f5a-19f38f1cc6f4 ro quiet splash
[ 32906.411] Build Date: 12 February 2015 02:49:29PM
[ 32906.411] xorg-server 2:1.15.1-0ubuntu2.7 (For technical support please see http://www.ubuntu.com/support)
[ 32906.411] Current version of pixman: 0.30.2
@rminderhoud
rminderhoud / django_error_test_database_1005.md
Created August 2, 2015 01:13
Fix mysql error 1005 when running django tests

#Django Test Database Error 1005 8/1/2015

Environment

  • Django 1.8.3
  • MySQL 5.5

When running python manage.py test I was receiving the following error

#/bin/bash
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
USER=`echo $REPO_URL | sed -Ene's#https://bitbucket.com/([^/]*)/(.*).git#\1#p'`
if [ -z "$USER" ]; then
@rminderhoud
rminderhoud / gist:8585717
Created January 23, 2014 19:59
Delete multiple remote branches
git branch -r | awk -Forigin/ '/PATTERN/ {print $2}' | xargs -I {} git push origin :{}
check which branches going to delete
git branch -r | awk -Forigin/ '/PATTERN/ {print $2}'
Source: http://stackoverflow.com/questions/10555136/delete-multiple-remote-branches-in-git#answer-13974015
@rminderhoud
rminderhoud / gist:8260431
Last active January 2, 2016 05:59
Sort by dot files first
export LC_COLLATE="C"

If you use a non-POSIX locale (e.g., by setting LC_ALL to en_US), then sort may produce output that is sorted differently than you're accustomed to.

In that case, set the LC_ALL environment variable to C. Note that setting only LC_COLLATE has two problems. First, it is ineffective if LC_ALL is also set. Second, it has undefined behavior if LC_CTYPE (or LANG, if LC_CTYPE is unset) is set to an incompatible value. For example, you get undefined behavior if LC_CTYPE is ja_JP.PCK but LC_COLLATE is en_US.UTF-8.

@rminderhoud
rminderhoud / gist:8259726
Last active January 2, 2016 05:49
Install virtualenv/virtualenvwrapper
Prerequisites (Debian/Ubuntu):
sudo apt-get install python python-dev python-setuptools build-essential
Pip
sudo easy_install pip
Virtualenv