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
import requests
def getSkills(username):
res = requests.get("https://apps.runescape.com/runemetrics/profile/profile?activities=0&user={username}".format(username=username))
skills =["attack","defence","strength","constitution","ranged","prayer","magic","cooking","woodcutting","fletching","fishing","firemaking","crafting","smithing","mining","herblore","agility","thieving","slayer","farming","runecrafting","hunter","construction","summoning","dungeoneering","runecrafting","invention","archaeology"]
return dict(zip(skills,list(sorted(res.json()['skillvalues'],key=lambda a: a['id']))))
def getJagexInfoByUsername(username):
res = requests.get(f"https://secure.runescape.com/m=hiscore/index_lite.ws?player={username}")
import requests,sys
url ="https://discord.com/api/webhooks/..."
data = {
"content" : sys.argv[1],
"username" : "Sharee Contenta"
}
files = {
'file': (sys.argv[2], open(sys.argv[2], 'rb')),
@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){
@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 / 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 / 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 / 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 / .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`
##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'
)
#!/usr/bin/env python
# coding: utf-8
# In[2]:
from PIL import Image
import random
import uuid
import os