Skip to content

Instantly share code, notes, and snippets.

View mrh1997's full-sized avatar

mrh1997

View GitHub Profile
@mrh1997
mrh1997 / mouse_searches_cheese.py
Created October 21, 2019 17:58
Mouse Searches Cheese in Labyrinth
from typing import NamedTuple, Optional
from enum import Enum
class Dir(Enum):
Up = 0
Right = 1
Down = 2
Left = 3
@mrh1997
mrh1997 / gist:4dc9fd6ea7cc9795a93c64f1829dd896
Created August 24, 2019 20:07
Debug Output of Vagrant Problem with SMB Shared Folders
Bringing machine 'macos' up with 'virtualbox' provider...
==> macos: Importing base box 'https://vagrant-osx.nyc3.digitaloceanspaces.com/osx-sierra-0.3.1.box'...
==> macos: Matching MAC address for NAT networking...
==> macos: Setting the name of the VM: 6003_baltech_sdk_macos_1566675902572_24670
==> macos: Fixed port collision for 22 => 2222. Now on port 2200.
==> macos: Preparing SMB shared folders...
Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
==> macos: Clearing any previously set network interfaces...
@mrh1997
mrh1997 / Vagrantfile
Created October 22, 2018 09:02
Linux Environment, that can run headlock (https://github.com/mrh1997/headlock)
Vagrant.configure("2") do |config|
config.vm.box = "koalephant/debian9-i386"
config.vm.provision "shell", inline: <<-SHELL
echo deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-7 main >>/etc/apt/sources.list
apt-get update
apt-get -y --allow-unauthenticated install libclang1-7
SHELL
end
@mrh1997
mrh1997 / diff-error.py
Created September 19, 2016 00:12
reproduce-pygit2-differror
import subprocess
import pygit2
import tempfile
REPODIR = tempfile.mkdtemp() + '/errrepo'
repo = pygit2.init_repository(REPODIR)
# create invalid tree with empty dir
emptyTree = repo.TreeBuilder().write()
@mrh1997
mrh1997 / wincred.py
Last active January 21, 2024 17:29
Retrieve Windows Credential via Python
#!python3
"""
Access windows credentials
"""
from typing import Tuple
import ctypes as CT
import ctypes.wintypes as WT
CRED_TYPE_GENERIC = 0x01
Invalid remote Gitlab url: https://gitlab.com/tobyd/drone-boat.git
@mrh1997
mrh1997 / Vagrantfile
Created April 28, 2016 00:22
Script to reproduce https://github.com/libgit2/pygit2/issues/625 by running ``vagrant up`` and ``vagrant ssh -- reproduce_memleak.py``
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.provision "shell", inline: <<-SHELL
# install components required for building libgit2 / pygit2
sudo apt-get install -y git
sudo apt-get install -y cmake
sudo apt-get install -y --fix-missing python-pip # ignore missing server
sudo apt-get install -y python-dev
sudo apt-get install -y python-cffi