Skip to content

Instantly share code, notes, and snippets.

@pilate
pilate / global-search.js
Last active July 21, 2021 14:27 — forked from stracker-phil/global-search.js
Recursively searches the entire object tree for a given value
/**
* Recursively searches the startObject for the given value.
*
* All matches are displayed in the browser console and stored in the global variable "gsResults"
* The function tries to simplify DOM element names by using their ID, when possible.
*
* Usage samples:
*
* globalSearch( document, 'someValue' ); // Search entire DOM document for the string value.
* globalSearch( document, '^start' ); // Simple regex search (function recognizes prefix/suffix patterns: "^..." or "...$").
// ==UserScript==
// @id FixMarket12321321
// @name FixMarket
// @version 1.0
// @namespace AB
// @author Pilate
// @description Fixes broken item tooltips on market pages
// @include http://steamcommunity.com/market/*
// @run-at document-end
// ==/UserScript==
// ==UserScript==
// @id FixMarket12321321
// @name FixMarket
// @version 1.0
// @namespace AB
// @author Pilate
// @description Fixes broken item tooltips on market pages
// @include http://steamcommunity.com/market/*
// @run-at document-end
// ==/UserScript==
ERROR [Thrift:22772] 2014-10-13 02:31:43,831 CustomTThreadPoolServer.java (line 224) Error occurred during processing of message.
java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:747)
at java.util.TimSort.mergeAt(TimSort.java:483)
at java.util.TimSort.mergeCollapse(TimSort.java:410)
at java.util.TimSort.sort(TimSort.java:214)
at java.util.TimSort.sort(TimSort.java:173)
at java.util.Arrays.sort(Arrays.java:659)
at java.util.Collections.sort(Collections.java:217)
at org.apache.cassandra.locator.AbstractEndpointSnitch.sortByProximity(AbstractEndpointSnitch.java:49)
@pilate
pilate / logging.py
Created July 14, 2014 17:56
Custom basicConfig test
def get_logger():
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s] %(message)s"))
logger = logging.getLogger("distribute")
logger.addHandler(handler)
logger.setLevel(10)
return logger
logger = get_logger()
[hpc72 ~]# nodetool info
Exception in thread "main" java.lang.AssertionError
at org.apache.cassandra.locator.TokenMetadata.getTokens(TokenMetadata.java:465)
at org.apache.cassandra.service.StorageService.getTokens(StorageService.java:2060)
at org.apache.cassandra.service.StorageService.getTokens(StorageService.java:2049)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75)
@pilate
pilate / urltitle.py
Last active December 22, 2015 09:59
from HTMLParser import HTMLParser
import requests
import re
url_regex = "(https?:\/\/[^ ]+)"
class TitleParser(HTMLParser):
istitle = False
.
|-- Actor-Mixer Hierarchy
| |-- Character
| | `-- CharacterActions
| | |-- ContextSensitiveActions
| | | |-- Ammo_Supply
| | | | |-- AmmoBox_LidClose
| | | | |-- AmmoBox_LidOpen
| | | | |-- AmmoBox_Lift
| | | | |-- AmmoBox_Place
8/24/11:
[21:23] <Jumpie> hah
[21:23] <Jumpie> obama is insane if he thinks he has a flying chance for reelection
8/29/12
[15:02] <Jumpie> just that...obama wont win
[15:02] <+ReadError> he answered the most important question
[15:02] <Jumpie> romney isnt perfect, but he's the better choice
9/7/12
@pilate
pilate / emptyrmq.py
Created November 6, 2012 17:04
Empty existing RabbitMQ Queue
import pika, json
# Clear the RMQ
def callback(ch, method, properties, body):
pass
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='Phantom')
channel.basic_consume(callback, queue='Phantom', no_ack=True)