Skip to content

Instantly share code, notes, and snippets.

// ==UserScript==
// @name Make Twitter Suck Less
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Make twitter suck slightly less by tweaking the layout
// @author @thebecwar
// @match http*://twitter.com/*
// @grant GM_addStyle
// ==/UserScript==
@thebecwar
thebecwar / counter.js
Created February 22, 2019 15:36
Stone counter
var gagStarted = new Date('2019-02-21T15:00:00+05:00');
function setupTimer() {
var timerSpan = document.createElement('span');
timerSpan.setAttribute('id', 'gag-time-content');
timerSpan.innerText = 'It has been 0 days, 0 hours, 0 minutes and 0 seconds since Roger Stone last violated his gag order';
var parent = document.getElementById('gag-timer');
if (parent) {
parent.appendChild(timerSpan);
}
}
@thebecwar
thebecwar / KilledByPolice-Json.user.js
Created March 23, 2018 01:04
Killed By Police Data Grab
// ==UserScript==
// @name KBP
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Parse KilledByPolice page into JSON data
// @author You
// @match http://killedbypolice.net/*
// @match http://www.killedbypolice.net/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js
// @grant none
@thebecwar
thebecwar / chudnovsky.py
Created March 18, 2018 03:56
Chudnovsky Algorithm in Python
import decimal
# for reference, the first 100 digits of pi
pi = decimal.Decimal('3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679')
# Basic recursive factorial calculation. For large n switch to iterative.
def fact(n):
if n == 0:
return 1
@thebecwar
thebecwar / trianglesquare.py
Last active August 29, 2017 22:47
Python script for calculating Triangle Square numbers
# This is Python 3, but the code should be pretty trivial to convert to Python 2
import time
start = time.time()
# Original method for calculating
a = 0
b = 0
x = []
h = 0
@thebecwar
thebecwar / UnclickHome.user.js
Created July 5, 2016 11:19
Switch to tab 2
// ==UserScript==
// @name UnclickHome
// @namespace NoNamespacePlease
// @include /^https?://(.*).stackoverflow\.com/.*/*
// @version 1
// @grant none
// ==/UserScript==
$(document).ready(function() {
var selTab = $(".selected.intellitab").attr("data-id");
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
namespace ScratchApp
{
public partial class Form1 : Form
{
@thebecwar
thebecwar / Implicit conversion.il
Created June 21, 2016 18:52
Implicit Widening conversions IL
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
// Code size 38 (0x26)
.maxstack 2
.locals init ([0] int64 num1,
[1] int32 num2,
[2] bool a,
[3] bool b,
[4] bool c)
@thebecwar
thebecwar / demo.cpp
Last active June 15, 2016 14:40
BADMACRO
#define BADMACRO(t, s, f) \
{\
##t str[] = s; \
f << str << endl; \
}
#define BADMACRO2(t, s, f) \
{ \
BADMACRO(##t, ##s, ##f) \
}
@thebecwar
thebecwar / Triggering.cs
Created November 5, 2015 18:13
Ideas for extending triggers to chat events
interface ITrigger
{
void ProcessMessage(Message msg, ref Room rm);
bool HandleChatEvent(EventType type, object EventData);
}
//OR
interface Hatman.Events.IChatEventHandler