This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import requests | |
from requests.auth import HTTPBasicAuth | |
directory = os.fsencode(os.getcwd()) | |
for file in os.listdir(directory): | |
filename = os.fsdecode(file) | |
response = requests.post('http://localhost', files={'file': open(filename, 'rb')}, auth=HTTPBasicAuth('user', 'pass')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
A very basic check digit example | |
Pulled from a Systems Modeling Exam | |
Rules are. | |
User inputs two digit number where the first digit is greater than 1 (so first number being 10) | |
Input is split and the sum of the two digits is the check digit, if greater than 9 the new numbers are summed together | |
giving the check digit | |
Examples: | |
11 = 112 (because 1 + 1 is 2) | |
76 = 764 (because 7 + 6 is 13, 1 + 3 is 4) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
rng = pd.date_range(start='1/1/1901', end='12/31/2000', freq='D') | |
count = 0 | |
for date in rng: | |
if date.weekday() == 6: | |
count += 1 | |
print(count) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: jQuery('label:contains("Competent")').not('label:contains("Not Yet Competent")').prev('input').attr('checked','checked');jQuery('textarea').val('Good Work');jQuery('body').animate({scrollTop:$(document).height()}, 'fast');jQuery('#SaveAndValidate').trigger("click"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@_shortener('blny.tk') | |
class Blnytk(Shortener): | |
def shorten(self, url, custom=None): | |
p = {'signature': '', 'format': 'json', 'keyword': custom, 'action': 'shorturl', 'url': url} | |
h = {'User-Agent': 'CloudBot Refresh'} | |
r = requests.get('http://blny.me/api.php', params=p, headers=h) | |
j = r.json() | |
if 'shorturl' in j: | |
return j['shorturl'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# russian roulette | |
import random | |
from util import hook | |
import os | |
import json | |
import time | |
@hook.command(autohelp=False) | |
def load(inp, say=None, me=None, chan=None): | |
"load [<number of barrels>] [<number of bullets>] - " \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cloudbot import hook | |
from cloudbot.util import web | |
import re | |
link_re = re.compile(r'((https?://([-\w\.]+)+(:\d+)?(/([\S/_\.]*(\?\S+)?)?)?))', re.I) | |
@hook.regex(link_re) | |
def autoshorten(match): |