Skip to content

Instantly share code, notes, and snippets.

@nolanlum
nolanlum / chatdump.py
Last active September 30, 2023 06:08
草まみれ
from typing import Callable, Iterable, List, NamedTuple, Optional
import json
from bs4 import BeautifulSoup
import requests
session = requests.Session()
// ==UserScript==
// @name MultiRowTabLiteforFx.uc.js
// @namespace http://space.geocities.yahoo.co.jp/gl/alice0775
// @description Multi-row tabs draggability fix, Experimental CSS version
// @include main
// @compatibility Firefox 69
// @author Alice0775, Endor8, TroudhuK, Izheil
// @version 06/09/2019 23:37 Fixed issue with tabs when moving to another window
// @version 05/09/2019 03:24 Fixed tab draggability to work with FF69
// @version 22/07/2019 19:21 Compatibility fix with Windows 7
#!/usr/bin/env python
# coding: utf8
import xchat, hashlib, json, os, math
__module_name__ = "split nicks"
__module_version__ = "1.0"
__module_description__ = "split nick colouration"
__module_author__ = "nattofriends"
@nolanlum
nolanlum / cozzie.py
Created May 4, 2015 10:50
15-puzzle solver via A* and a first-row LUT heuristic. for https://paiza.jp/poh/enshura-special (doesn't actually work because ????)
This file has been truncated, but you can view the full file.
from heapq import heappush, heappop
from cPickle import loads
from base64 import b64decode
from bz2 import decompress
lut = {'1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, 'a': 10, 'b': 11, 'c': 12, 'd': 13, 'e': 14, 'f': 15}
top_lut = {'1': '1', '2': '2', '3': '3', '4': '4', '5': '0', '6': '0', '7': '0', '8': '0', '9': '0', 'a': '0', 'b': '0', 'c': '0', 'd': '0', 'e': '0', 'f': '0', '*': '*'}
top_heuristic = loads(decompress(b64decode(
'QlpoOTFBWSZTWQ2wWC4G3cZ+wH////////wAAAgCACICQABlWLwHJPtF666VW6Xbu4nLHRpqnd3Yy25VnGCunXSVcrVmHd1F1bMS'
+ 'bSMhiR0qazXabgKtzc3Z3bTtcauprVAUAw7u7da4UoANits1aatgO5O7oANAME5HdhQCbNUttrWo7u6c3DoUBI0Fbnau1QyaoA0O'
@nolanlum
nolanlum / bind.c
Created September 22, 2014 08:37
LD_PRELOAD library to make bind and connect use a specific IP address. Now works with IPv6.
/*
* Copyright (c) 2014 Nolan Lum <nolan@nolm.name>
*
* Updated to support IPv6. Use the environment variable BIND_ADDR6.
*/
/*
Copyright (C) 2000 Daniel Ryde
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@nolanlum
nolanlum / ganbarimax.c
Created February 14, 2014 09:39
Recover data from truncated ZIP files. (´・ω・`)
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <WinBase.h>
// ZIP files are gross.
#pragma pack(1)
@nolanlum
nolanlum / PaydaySaveParser.py
Created January 8, 2014 03:55
Save parsing/modification library for Payday 2: The Heist. Saves and loads directly from the steam cloud file in the payday userdata folder. After making modifications via the dict structure, supports saving back into flatfile form that the client loads and will validate.
# coding=utf-8
import hashlib
import sys
from binascii import b2a_hex
from collections import OrderedDict, namedtuple
from struct import pack, unpack_from
SizedInt = namedtuple('SizedInt', ['size', 'value'])
size_to_c_name = {1: 'byte', 2: 'short', 4: 'int'}
SizedInt.__str__ = lambda self: "%s(%s)" % (size_to_c_name[self.size], self.value)
import urllib2
import re
import json
from collections import namedtuple
oper_pattern = re.compile(r"(abs|add|subtract|multiply)\(([-0-9]+)(?:,([-0-9]+))?\)")
oper_map = {
"abs" : lambda x, y: abs(long(x)),
"add" : lambda x, y: long(x) + long(y),
"subtract" : lambda x, y: long(x) - long(y),
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="Hilfinger" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
import sqlite3, datetime, HTMLParser, re, sys
from datetime import datetime
CHAT_ID = '#newyorkkid618/$68805f313f49f8a'
IN_FILE = 'main.db'
OUT_FILE = 'dump.txt'
def format_time(t):
TIME_FORMAT = '{}/{}/{} {}:{:02n}:{:02n} {}'