Skip to content

Instantly share code, notes, and snippets.

View nitrocode's full-sized avatar
🚀
Thinking and typing

RB nitrocode

🚀
Thinking and typing
View GitHub Profile
@nitrocode
nitrocode / windows-ultimate-upgrade-pip-and-choco.bat
Last active February 20, 2016 03:26
Upgrade all Windows pip packages and choco packages
@echo off
:: upgrade pip, setuptools, pip packages, and all choco packages
:: upgrade pip
pip install -U pip
:: upgrade setuptools
pip install setuptools --no-use-wheel --upgrade
:: upgrade all pip packages
@nitrocode
nitrocode / imapPoll.py
Last active December 15, 2015 14:58
Poll imap for a particular subject and download its attachment
#!/usr/bin/python
# Polls imap server, searches for a string in an unread email's subject, and downloads its attachment.
#
# Use case:
# Someone refuses or does not know how to save an attachment to a webserver so he/she sends
# it via email and so the imap server has to be polled, the email has to be found, and then the attachment
# can be downloaded
#
# Todo: Finish class
# Todo: Commandline arguments
@nitrocode
nitrocode / export-all-esx-vms-using-ovftool.sh
Last active January 13, 2022 16:06
Export all VMs on an ESX server using the ovftool
#!/bin/bash
# This script will export all your VMs from an ESX server using the ovftool
# - Provide the esx ip, esx user, and esx pass
# - Make sure the password follows unicode conventions e.g. the @ sign is %40
# - Also make sure all VMs are reverted and shutdown
# - This does not export snapshots
# How it works:
#
# runs vim-cmd to get all the vms on the esx server
@nitrocode
nitrocode / ultimate-shell-aliases.sh
Last active June 16, 2016 20:17
Eventually will contain all my favorite and useful aliases
#!/bin/bash
# Work in progress
# A lot of aliases are already covered by ohmyzsh
# ls aliases
## shows ls in color, shows directories prefixed with a /, and shows directories first
alias ls='ls -F --color=auto --group-directories-first'
## Use a long listing format ##
alias ll='ls -la'
## Show hidden files ##
@nitrocode
nitrocode / check-website-ssl-from-file.py
Created February 23, 2016 05:42
Checks a new line delimited url file for https, http redirection, and a valid ssl certificate
#!/usr/bin/python
# Description:
# Checks websites for https from a text file. The text file must be
# new line delimited.
#
# Usage:
# python script.py myfileoflinks.txt
#
# Install:
# pip install tabulate
@nitrocode
nitrocode / ultimate-vimrc
Last active July 7, 2016 19:55
vimrc for linux and cygwin
" too lazy to look up these but these are guaranteed to benefit me in linux and cygwin
set nocompatible
set backspace=indent,eol,start
set backup
set history=50
set ruler
set background=dark
set showcmd
set incsearch
set bs=2
@nitrocode
nitrocode / upload-file-rest-endpoint-requests.py
Last active December 5, 2017 03:58
Uploads file with a rest end point using python's request module
#!/usr/bin/env python
import requests
import os
def upload_file(url, file_loc, cookies=None, headers=None,
file_type='application/vnd.ms-excel'):
"""Upload a file using an end point using requests posting of
a multipart encoded file
@nitrocode
nitrocode / ultimate-nanorc
Created July 7, 2016 22:03
Personal nanorc file because CRLF drives me nuts
include /usr/share/nano/python.nanorc
include /usr/share/nano/sh.nanorc
set nowrap
set nonewlines
set tabsize 4
set tabstospaces
@nitrocode
nitrocode / getDictValueFromPath.py
Last active July 21, 2020 22:00
Gets a value from a dictionary using a list key path
#!/usr/bin/env python
def getDictValueFromPath(listKeys, jsonData):
"""Retrieve value from a dictionary using a list of keys.
>>> mydict = {
'a': {
'b': {
'c': '1'
}
@nitrocode
nitrocode / cut-up-git-repos.sh
Created June 20, 2017 15:22
Cut up a git repo into smaller repos
# clone url of current repo
curremote="[email protected]:xyz/123.git"
newremote="ssh://[email protected]/123.git"
# new cloned directory of current repo - doesn't matter the name
newdirname="my-new-agent-repo"
# original directory of files in current repo
keepdir="my-current-agent"
# clone and checkout branches
#git clone --mirror $curremote $newdirname
git clone $curremote $newdirname