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 requests | |
from bs4 import BeautifulSoup as Soup | |
import json | |
import re | |
import time | |
import datetime | |
import dateparser | |
from collections import defaultdict | |
import os |
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:(function(){function urlsafe_encode(s){return btoa(s).replace(/\+/g, "-").replace(/\//g, "_")};function encode_utf8(s) {return unescape(encodeURIComponent(s));};function add_spoiler(){try{var input = document.getElementById("input");var left = input.value.slice(0, input.selectionStart);var middle = input.value.slice(input.selectionStart, input.selectionEnd);var right = input.value.slice(input.selectionEnd);if (middle.length == 0){var response = window.prompt("Enter spoiler text.", "");if (response == null || response.length == 0){return;}else{middle = response;};};middle = encode_utf8(middle);middle = encodeURIComponent(urlsafe_encode(middle));middle = "[view spoiler](http://sopython.com/spoiler/" + middle + ")";input.value = left + middle + right;input.setSelectionRange(left.length + middle.length, left.length + middle.length);input.focus();}catch(e){console.log(e);};};function create_button(name, id, func){var buttonArea = document.getElementById("chat-buttons");var button = document.createElemen |
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
// ==UserScript== | |
// @name Hacker News Post Sorter | |
// @namespace . | |
// @include https://news.ycombinator.com/ | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
HTMLCollection.prototype.forEach = Array.prototype.forEach; |
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 math | |
class Point(object): | |
def __init__(self, *args, **kargs): | |
self.num_dimensions = kargs.get("num_dimensions", len(args)) | |
self.coords = [0 for i in range(self.num_dimensions)] | |
for i in range(len(args)): | |
self.coords[i] = args[i] | |
"""Gives the distance from this point to the origin.""" |
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
// ==UserScript== | |
// @name User Notes (SO Chat) | |
// @namespace . | |
// @include http://chat.stackoverflow.com/rooms/* | |
// @include https://chat.stackoverflow.com/rooms/* | |
// @version 2 | |
// @grant GM_getValue | |
// @grant GM_setValue | |
// ==/UserScript== |
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
try: | |
from tkinter import * | |
except ImportError: | |
from Tkinter import * | |
try: | |
from queue import Queue | |
except ImportError: | |
from Queue import Queue |
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 tkinter import Tk, Entry, Frame, Label, StringVar | |
import struct | |
import traceback | |
def float_to_int(x): | |
s = struct.pack("d", x) | |
x = 0 | |
for value in s[::-1]: | |
x = (x << 8) | value | |
return x |
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
// ==UserScript== | |
// @name Common Comments Box (Stack Overflow) | |
// @namespace about:blank | |
// @include http*://stackoverflow.com/questions/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var question_comments = [ | |
"Are you getting an error? If so, what is the error and stack trace? Is your code running, but producing unexpected output? If so, what output are you getting, and what output did you expect to get?", |
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
#animation.py | |
#prerequisites: ImageMagick (http://www.imagemagick.org/script/index.php) | |
import itertools | |
import os | |
import os.path | |
import subprocess | |
import shutil | |
import math | |
def generate_unused_folder_name(): |