Skip to content

Instantly share code, notes, and snippets.

<#
Create Unix VM's.
PREREQUISITES:
- A VM that has been installed with an OS that supports cloud-init
- cloud-init is installed on the vm
How it works:
- Asks for a bunch of parameters
- Creates a disk from parent vhdx for speed
#!/bin/bash
# https://gist.github.com/koenpunt/40c0b042c453a1add0e8
#
# Check if the user is in the right group
# and afterwards retrieve the SSH public key from LDAP
# Logs directly in Syslog
# requires ldap-utils
#
# sshd_config for OpenSSH 6.2 or higher:
#
@jmcmellen
jmcmellen / pycurses.py
Created May 6, 2020 15:02 — forked from claymcleod/pycurses.py
Python curses example
import sys,os
import curses
def draw_menu(stdscr):
k = 0
cursor_x = 0
cursor_y = 0
# Clear and refresh the screen for a blank canvas
stdscr.clear()
@jmcmellen
jmcmellen / init.coffee
Last active June 15, 2018 15:55
Atom init script. This shows how to make atom understand my paths, and use ssh-agent for git stuff
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@jmcmellen
jmcmellen / DASL Filter for Outlook.txt
Created March 11, 2016 20:12
Filter Outlook view to show only unread, flagged, or today's email
("urn:schemas:httpmail:read" = 0 OR "http://schemas.microsoft.com/mapi/proptag/0x10900003" > 1 OR
%today("urn:schemas:httpmail:datereceived")% )
@jmcmellen
jmcmellen / batchit.py
Created March 8, 2016 17:58
Go through files and do something to them. Uses multiprocessing.
import os
import subprocess
from multiprocessing import Pool
def main():
fileList = []
for root, dirs, files in os.walk("."):
for file in files:
full_file = os.path.abspath("{0}\\{1}".format(root, file))
@jmcmellen
jmcmellen / getYBYG.py
Last active September 22, 2015 15:29
A script to download wave files from an FTP server and put CartChunk data on them for ingestion. Restart partial downloads. Uses a breaker pattern and a progress bar. Apologies for the global vars.
import cdpwavefile
import ftplib
import socket
from datetime import date, timedelta
import os
import io
import sys
import time
import pyprind
@jmcmellen
jmcmellen / make_promo.py
Created March 23, 2015 19:43
Using pydub to mix and tag promos with bed music
from pydub import AudioSegment
from pydub import playback as player
import math
raw_promo = AudioSegment.from_mp3("FreshA7__1500.mp2")
tag = AudioSegment.from_wav("FA_tag2.wav")
tag_adjust = round(20 * math.log10(float(raw_promo.rms) / tag.rms), 1)
tag = tag + tag_adjust
@jmcmellen
jmcmellen / getflowdockstream.py
Last active August 29, 2015 14:13
Use the Stream API to get realtime info from FlowDock API
import sseclient
import requests
import getpass
def main():
print "hello world"
# This uses the code you get from the app
# fields = {'code': code,
@jmcmellen
jmcmellen / fsevents.py
Last active August 29, 2015 14:10
Watch a folder with pyuv
import signal
import pyuv
def on_fs_event(evt_handle, filename, events, error):
print evt_handle.filename, events
def handler_closing(handle):
print "Closing", handle
handle.close(handler_closed)