Skip to content

Instantly share code, notes, and snippets.

View transistor1's full-sized avatar

Steve Russo transistor1

View GitHub Profile
@transistor1
transistor1 / nswrap.py
Created May 19, 2024 02:02
Wraps a dict object in a namespace object recursively
class nswrap:
"""Wraps a dict object in a namespace object recursively.
Like SimpleNamespace, except recursive. Makes discovery of
dictionaries easier in JupyterLab.
"""
def __init__(self, d):
"""_summary_
Args:
d (dict): A dictionary
@transistor1
transistor1 / redirect.py
Last active September 24, 2022 22:24 — forked from natedileas/redirect.py
c-level stdout redirection on windows
""" Tested on Windows 10, 64 bit, Python 3.6
Sources:
https://eli.thegreenplace.net/2015/redirecting-all-kinds-of-stdout-in-python/
https://stackoverflow.com/questions/17942874/stdout-redirection-with-ctypes
Adapted as multiplatform c-redirect
"""
from contextlib import contextmanager
#!/bin/bash
# Source: https://forums.macrumors.com/threads/is-my-virtual-mac-pro-better-than-your-real-mp.2121703/#post-27283133
# See https://www.mail-archive.com/[email protected]/msg471657.html thread.
#
# The "pc-q35-2.4" machine type was changed to "pc-q35-2.9" on 06-August-2017.
#
# The "media=cdrom" part is needed to make Clover recognize the bootable ISO
# image.
@transistor1
transistor1 / mkseabios.sh
Created April 12, 2019 17:13
Make seabios v1.7.4
#!/bin/bash
mkdir -p /home/$(whoami)/OSXGUEST
cd /home/$(whoami)/OSXGUEST
git clone https://github.com/coreboot/seabios.git
wget https://raw.githubusercontent.com/transistor1/packages-archlinux/master/seabios-osx-git/seabios-dmi-cumulative-20140204.patch
cd seabios
git checkout rel-1.7.4
patch -p1 < ../seabios-dmi-cumulative-20140204.patch
cd ..
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
cinst visualstudio2017professional
cinst visualstudio2017-workload-manageddesktop
cinst wixtoolset
cinst git
cinst kdiff3
cinst gitextensions
cinst office365business
@transistor1
transistor1 / patch.diff
Created May 11, 2015 23:38
Patch to AntlrWorks2 commit bfee49a9b029625ef3bffeaa1b026d2bbc95b61d
diff --git a/nbproject/antlrworks2.conf b/nbproject/antlrworks2.conf
index f3dd168..4f4d7f0 100644
--- a/nbproject/antlrworks2.conf
+++ b/nbproject/antlrworks2.conf
@@ -9,6 +9,7 @@ default_options="-J-server -J-XX:+TieredCompilation -J-Xms128m -J-Dnetbeans.logg
# default location of JDK/JRE, can be overridden by using --jdkhome <dir> switch
#jdkhome="/path/to/jdk"
+jdkhome="/usr/lib/jvm/java-8-oracle/jre"
@transistor1
transistor1 / remove-docker-orphaned.py
Created March 19, 2015 04:06
This script removes orphaned folders from docker to reclaim space. I didn't write it, but I can't remember where I got it from; it was posted on one of the github issue logs for docker. I am posting it here so I don't lose it.
#!/usr/bin/env python
"""
Check all existing Docker containers for their mapped paths, and then purge any
zombie directories in docker's volumes directory which don't correspond to an
existing container.
"""
# By using execfile(this_file, dict(__file__=this_file)) you will
this_file="/home/russosv/bin/env/bin/activate_this.py"
namespace Zeta.EnterpriseLibrary.Tools
{
#region Using directives.
// ----------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security;
@transistor1
transistor1 / mkrepo.sh
Last active August 29, 2015 14:03
Push a folder to a plugin repo
#!/bin/bash
USER=git-username
PREFIX=shellista
REPO=$PREFIX-$1
echo "Enter password:"
read -s PASSWORD
curl -u "$USER:$PASSWORD" https://api.github.com/user/repos -d "{\"name\":\"$REPO\"}"
@transistor1
transistor1 / shellista.py
Created June 19, 2014 14:44
shellista.py
import os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip, string, urllib2, traceback, time, json
# Credits
#
# The python code here was written by pudquick@github
#
# License
#
# This code is released under a standard MIT license.
#