Skip to content

Instantly share code, notes, and snippets.

# Month of the year -- Table 1
month1 = 'January'
month2 = 'February'
month3 = 'March'
month4 = 'April'
month5 = 'May'
month6 = 'June'
month7 = 'July'
month8 = 'August'
month9 = 'September'
def count_substring(string, sub_string):
count = 0
for i, value in enumerate(string):
if string[i:i+len(sub_string)] == sub_string:
count += 1
return count
#print("match at string[" + str(i) + "]")
if __name__ == '__main__':
n = int(input())
s = set(map(int, input().split()))
N = int(input())
for i in range(N):
cmd=input().split()
if cmd[0]=="pop":
s.pop()
else:
s.cmd[0](int(cmd[1]))
#!python3
import requests as req
import re
first_names_m = []
first_names_f = []
last_names = []
# Get the raw page data into usable text format #
js = req.get('https://www.fantasynamegenerators.com/scripts/russianNames.js')
@mightywombat
mightywombat / printerpoke.py
Last active February 13, 2020 19:52
Wakefulness script for work printer
import mechanize
# DEFINE PRINTER NAMES, IPs, AND DEFAULT STATUS (FALSE)
# FUTURE VERSION WILL REFERENCE EXCEL SHEET FOR PRINTER IPS FOR SCALABILITY
printers = [
{'name': 'N1', 'ip': '10.3.16.32', 'status': 0},
{'name': 'N2', 'ip': '10.3.8.30', 'status': 0},
{'name': 'P1', 'ip': '10.3.16.31', 'status': 0},
{'name': 'P3', 'ip': '10.3.16.30', 'status': 0}
]
@mightywombat
mightywombat / relModKiller
Created March 21, 2019 20:53
Modern Word Killer
Assign user-provided era to global variable
Filter lists:
wordAgeList - filter relative-modern words to relModWords list
idiomAgeList - filter relative-modern phrases to relModIdiom list
idiomAgeList - filter relative-old phrases to relOldIdiom list
# later user option to allow older idioms, user option to specify age of idioms to allow
commonWordList - filter relative modern words to relModWords list (same list as above)
commonWordList - filter contemporary words to contempCom list
@mightywombat
mightywombat / tweepbot.py
Created February 26, 2019 19:09
Posts to Twitter
import twitter
api = twitter.Api(consumer_key=[consumer key],
consumer_secret=[consumer secret],
access_token_key=[access token],
access_token_secret=[access token secret])
status = api.PostUpdate('@madsc13ntist I\'m callin\' you out!')
print(status.text)
@mightywombat
mightywombat / encounter_gen.py
Last active May 9, 2018 22:26
RPG encounter generator.
import Tkinter as tk
import random
import string
root = tk.Tk()
frame = tk.Frame(root)
frame.pack()
# Data pile
about_txt = "This is where the about stuff goes..."
@mightywombat
mightywombat / roshambo.py
Last active April 23, 2018 23:12
practicepython.org Ex 08
# practicepython.org Ex 08
import getpass as g
import string
def crush(word): # Removes all variables from input text for maximum ease of parsing.
word = word.replace(" ", "") # Removes spaces.
word = string.lower(word) # Changes all letters to lowercase.
for c in word:
if c in string.punctuation:
@mightywombat
mightywombat / palindrome.py
Created April 20, 2018 19:55
practicepython.org Ex 06
# practicepython.org Ex 06
import string
word = raw_input("Palindrome checker. Enter your palindrome: ")
#print word
word = word.replace(" ", "") # Removes spaces.
#print word