Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View 13steinj's full-sized avatar
⚒️
Compiling!

13steinj

⚒️
Compiling!
View GitHub Profile
@13steinj
13steinj / sticky_setting_toggle.py
Last active December 16, 2018 09:53
Script to toggle a subreddit setting it any sticky matches a given regexp
#!/usr/bin/env python
"""Script to toggle a subreddit setting it any sticky matches a given regexp"""
from argparse import ArgumentParser
from praw import Reddit
from re import compile as re_compile
praw_config = {
'user_agent': __doc__, # change this to be nice to reddit's API guides
}
@13steinj
13steinj / 0001-Resurrection.patch
Last active December 29, 2018 02:01
Patch to revert Native LaF removal (Jetbrains IDEs)
From a2b400805644075765a66e8747af6cbb4262bb12 Mon Sep 17 00:00:00 2001
From: 13steinj <13steinj@users.noreply.github.com>
Date: Sun, 16 Dec 2018 01:10:40 -0500
Subject: [PATCH] Resurrection
---
.../NotificationMessageElement.java | 3 +-
.../daemon/impl/HectorComponent.java | 8 +-
.../intellij/find/SearchReplaceComponent.java | 10 ++
.../src/com/intellij/find/SearchTextArea.java | 17 ++-
@13steinj
13steinj / import_wtf.py
Created February 6, 2018 08:16
How in the world does this occur?
>>> import timeit, dis
>>> t1 = timeit.Timer("""def foo(): return pprint.pprint([])""", setup="import pprint")
>>> t2 = timeit.Timer("""def foo(): import pprint; return pprint.pprint([])""")
>>> t1.repeat()
[0.1467437744140625, 0.12576889991760254, 0.12010502815246582]
>>> t2.repeat()
[0.08302998542785645, 0.07528400421142578, 0.07703089714050293]
>>> def foo(): return pprint.pprint([])
>>> def foo2(): import pprint; return pprint.pprint([])
>>> dis.dis(foo)
from collections import deque, defaultdict
import gdax
import calendar
from dateutil.parser import parse
from threading import RLock
deques = defaultdict(deque)
pop_lock = RLock()
@13steinj
13steinj / Functionfitters.py
Last active October 29, 2017 01:54
Some functions that are used to fit functions, yo
"""A calculation of functions using python.
Any mathematical asumptions need to be either stated,
or given as fact. To optimize this file, mathematical
expressions are used to simplify things. For example,
using manipulation on eulers formula,
cosh(x) = cos(ix), and cos(x) = cosh(ix). This would
greatly simplify the latter regression by induction.
"""
@13steinj
13steinj / keybase.md
Created November 24, 2016 23:11
My keybase proof

Keybase proof

I hereby claim:

  • I am 13steinj on github.
  • I am 13steinj (https://keybase.io/13steinj) on keybase.
  • I have a public key ASDfN1Zp_Xjv7_xqFai2tDb1oOn55E2Vbh1EmsPwfXU7-Ao

To claim this, I am signing this object:

import math
n = 1 # potential number of nuggets to be bought
bestSoFar = [] # that keeps track of largest number of McNuggets that cannot be bought in exact quantity
packages = [6,9,20] # list that contains package sizes
count = 0 # of times 'n' test has returned True
count_limit = 6 # limit to n, n+1,...,n+5 theorem, if 6 consecutive numbers are True then all after are True.
@13steinj
13steinj / methodoverloader.py
Created May 17, 2016 15:29
this porbably doesnt work i dont remember what I did for work
try:
from inspect import getfullargspec as gas
except ImportError:
from inspect import getargspec as gas
class UnannotatedArg(object):
def __eq__(self, other):
return True
class OverloadedMethod(object):
@13steinj
13steinj / xpost.py
Created April 8, 2016 01:02
WPxPOST
import re
import praw
import OAuth2Util
from praw.helpers import _stream_generator
from praw.objects import Comment, Submission
USERNAME = "Kim_MahJong"
POSTSUB = "Kim_MahJongWrites"
@13steinj
13steinj / robinpraw.py
Created April 5, 2016 00:37
A PRAW3 addon for reddit robin interaction
import json
from praw import Reddit
from praw.objects import RedditContentObject, Redditor
class Reddit(Reddit):
def __init__(self, *args, **kwargs):
super(Reddit, self).__init__(*args, **kwargs)
self.__inject_config()