Skip to content

Instantly share code, notes, and snippets.

@andyneff
andyneff / reset_adapters.bat
Created December 12, 2015 14:59
Windows: Resetting network adapters matching a string pattern
:' Reset Networks devices matching %1 pattern
:' Example: To reset all virtual box network adapters "reset_adapters.bat VirtualBox"
:'^
a=1_
<1' echo off <nul
set n=nothing' & goto :'batchCode & REM Jump to the batch code
Set UAC = CreateObject("Shell.Application")
UAC.ShellExecute WScript.ScriptFullName, Wscript.Arguments.item(0), "", "runas", 1
@andyneff
andyneff / Hybrid_files.md
Last active May 16, 2024 15:45
Hybrid script files

Hybrid files

  • A short compilations of hybrid files I've used/modifies whats out there for my use.

What do I mean by hybrid files? A file that can be parsed by two or more scripting lanauges and run (without or minimal error messages)

Batch and python

I copied this from here There are many different versions out there, of varying degrees of difficulty out there. However this is my favorite

@andyneff
andyneff / Docker clean.md
Last active May 3, 2017 16:22
With the lack of a docker clean command, I've created a few bash functions/scripts to helps me deal with cleaning up dockers

Since docker isn't like git in that creating a docker-clean in the path will create a docker clean command, I've settled for dc_blah :(

Most of these command do NOT have safe guards yet, bad inputs can cause you to lose all your docker images. USE AT OWN RISK!

  • dc_ps - Removes all dead containers. This is safe AS LONG as you don't want to try and commit any of your dead dockers
  • dc_images - Removes all dangling images. When rebuilding a dockerfile, previous intermediate images get left behind (as dangling) this removes them
  • dc_trace - List all the image snapshots that make up a particular image. It lists the parent, grandparent, etc... all the way to the begining image. It also lists the actual size of each of these snapshots in human readable sizes
  • dc_trace_cmd - Same as dc_trace, except it also lists the "dockerfile command" that created that image. This only makes sense for images made with docker build. It makes less sense with images build by docker commit
  • dc_trace_q - Version o
#!/usr/bin/env python
import os
import csv
from StringIO import StringIO
import argparse
def parser():
argparser = argparse.ArgumentParser()
aa = argparser.add_argument
@andyneff
andyneff / nvidia_version.md
Last active August 17, 2017 17:20
Cuda vs Nvidia Driver version
Cuda Version Minimum Nvidia Driver Version needed (for Linux)
9.0 ?384.59?
8.0 361.xx
7.5 352.xx
7.0 346.xx
6.5 340.xx
6.0 331.xx
5.5 319.xx
5.0 304.xx
@andyneff
andyneff / rokh.py
Last active May 8, 2024 16:43
Python file for parsing uasset files from Rokh
import logging
import re
import collections
import struct
from StringIO import StringIO
import codecs
import binascii
import math
import sys
@andyneff
andyneff / README.md
Created October 23, 2017 22:06
Adding Fedora 27 to UNetBootin
  1. Add the Fedora 27 iso like any other ISO
  2. Create a Fedora27 directory in the USB key
  3. Move EFI, Fedora-Legal-README.txt, images, isolinux, LICENSE, TRANS.TBL into the Fedora27 directory. I do this to move all the Fedora 27 files out of the way, decreasing the change of a filenae colision
  4. Edit ubnpathl.txt and add Fedora27/ infront of every line except LiveOS
  5. Edit ubnfilel.txt and add Fedora27/ infront of every line except starting with LiveOS
  6. Edit syslinux.cfg. Many of the Fedora menu items are messed up (leave the first few lines alone, or customize them to your preference)
label unetbootindefault
menu label Default
@andyneff
andyneff / de_activate.bsh
Last active March 14, 2019 21:17
Like a virtual env for docker
#!/usr/bin/env bash
function _de_cleanup()
{
for f in ~/.ssh/docker_*; do
if ! \fuser "${f}" >& /dev/null; then
\rm "${f}"
fi
done
}
@andyneff
andyneff / egl_notes.md
Created December 29, 2017 16:54
EGL Notes.md

Gotchas

  • Nvidia Driver 375.39 on ubuntu is broken when it comes to EGL. Follow comment #11 to fix the host machine.
    • To fix an nvidia-docker driver mount, you need to either fix /var/lib/nvidia-docker/volumes/nvidia_driver/375.39/lib64 or use a docker via docker run -it --rm -v nvidia_driver_375.39:/nvidia_driver debian to gain write permissions to the drivers, and patch them.
      • Copy /usr/lib/nvidia-375/libEGL.so.375.39 into the {nvidia_driver}/lib64/ directory
      • Make sure the symlinks for {nvidia_driver}/lib64/libEGL.so.1 and {nvidia_driver}/lib64/libEGL.so eventually link to the libEGL.so.375.39 file.
  • If you have the environment variable DISPLAY set, EGL will try and use the actual Display for offscreen OpenGL rendering instead of the headless route. This is difficult (but not impossible) because now you must run the command as the same user as the graphically logged in user.
@andyneff
andyneff / mitm_kdiff3.sh
Created March 27, 2018 16:04
Adding a custom kdiff3 mergetool
#!/usr/bin/env bash
# Add to .gitconfig
# [merge]
# tool = mitmkdiff3
# [mergetool.mitmkdiff3]
# cmd = mitm_kdiff3 "$LOCAL" "$REMOTE" "$MERGED" "$BASE"
: ${MERGE_TOOLS_DIR=$(git --exec-path)/mergetools}