Skip to content

Instantly share code, notes, and snippets.

View sam2332's full-sized avatar

Lily Rudloff sam2332

  • Ingham County
  • Lansing, Michigan
View GitHub Profile
@sam2332
sam2332 / File_Vault.php
Last active May 14, 2018 15:43
this is a simple file based caching system
<?php
/**
* Created by Sam Rudloff.
* Date: 5/14/18
* Time: 11:26 AM
*/
class file_vault
{
public function __construct($path)
#!/usr/bin/env python
# coding: utf-8
# In[2]:
from PIL import Image
import random
import uuid
import os
#!/usr/bin/env python
# coding: utf-8
# In[2]:
from PIL import Image
import random
import uuid
import os
##Magic Logging Bootstrap
import logging
import sys,os
logging.basicConfig(
filename='randomWp.log',
level=logging.INFO,
format='%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
@sam2332
sam2332 / .bashrc_autoconnect.sh
Created February 22, 2022 15:47
bashrc addon for connecting to windows shares from a linux host if connected to vpn.sh
share_mount_dir='/home/srudloff/shares'
vpn_connected=`ifconfig | grep "tun0"|wc -c`
if (( vpn_connected > 0 )); then
if [[ $(keyring get VPN_SYSTEM DOMAIN | wc -c) -eq 0 ]];then
keyring set VPN_SYSTEM DOMAIN
fi
SMB_DOMAIN=`keyring get VPN_SYSTEM DOMAIN`
@sam2332
sam2332 / Python Logging Easy.py
Created February 22, 2022 17:23
Easy Python Logging setup
##Magic Logging Bootstrap
import logging
import sys
logging.basicConfig(
filename='randomWp.log',
level=logging.INFO,
format='%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
@sam2332
sam2332 / nbRunner.py
Last active March 1, 2022 21:18
The shortest code to run a jupyter notebook and retrieve the output from all cells.
import argparse
import nbclient
import nbformat
import nbparameterise
import sys
old_stdout = sys.stdout
parser = argparse.ArgumentParser(
description='Notebook Runner'
)
@sam2332
sam2332 / TextareaAutoExpand.js
Last active April 6, 2022 21:25
Make text areas show one more line than is present in the value
$('textarea.AutoExapander').keyup(function (e) {
e.target.rows = e.target.value.split('\n').length + 1
});
$(document).ready(function () {
$('textarea.AutoExapander').each(function (index, ele) {
ele.rows = ele.value.split('\n').length + 1
})
})
@sam2332
sam2332 / Totalizer.js
Created April 6, 2022 21:24
Total a list of dom elements and put the output in a destination
function Totalizer() {
this.output = null
this.elements = []
this.total = 0
}
Totalizer.prototype.setOutput = function (output) {
this.output = $(output);
this.updateOutput()
}
@sam2332
sam2332 / RedMind - SpongeMock.user.js
Created April 8, 2022 14:46
Make fun of everything in redmine support
// ==UserScript==
// @name Redmine - SpongeMock
// @match https://*.*.*/issues/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var letters = "abcdefghijklmnopqrstuvwxyz"
function mocking(text){