Skip to content

Instantly share code, notes, and snippets.

View DanielOaks's full-sized avatar

Daniel Oaks DanielOaks

View GitHub Profile
@DanielOaks
DanielOaks / simple_irc.py
Created October 12, 2014 22:28
Berend's simple IRC bot, extended
#!/usr/bin/env python3
# Test IRC Client
# Based on http://hawkee.com/snippet/9725/
import os
import socket
import traceback
# settings
nick = 'bython'
@DanielOaks
DanielOaks / irc_fuzz.py
Last active April 12, 2020 15:28
Little IRC server fuzzer
#!/usr/bin/env python3
# IRC Server fuzzing, made easy!
import time
import socket
import select
import random
# settings
hostname = '127.0.0.1'
@DanielOaks
DanielOaks / m_fuzz4.c
Created October 20, 2014 23:19
ircfuzz for plexus4
/************************************************************************
* IRC - Internet Relay Chat,
* Copyright (C) 2001 Hybrid Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
@DanielOaks
DanielOaks / basc_4chan_archiver_refactor.py
Created November 15, 2014 08:10
Discussion/coding for the 4chan archiver I had with @antonizoon
# Archiver options object proposal
""" might only need to be an Archiver constructor now?
not sure, how do you mean exactly?
as I see it, the main reason to make the Options class is to simplify things internally
like passing options between the Archiver and the SiteArchivers (or whatever we do to support 4chan/Fuuka/etc)
I can certainly see doing it like that, but even then I think we'd be creating an Options object internally. Definitely different files, but subclassing from a standard BaseSiteArchiver or something similar, so those objects have the same API to the controlling Archiver object (and can be used as a simple list to iterate over, below in add_thread and download_threads)
well, that make sense. True, that would really help to have a unified GUI.
I might start playing about with refactoring the repo
probably want to create a brand new repo, since we wrote from scratch anyway, name it BASC_Archiver
sure, I'll be reusing lots of code from BA-4chan-thread-archiver as
@DanielOaks
DanielOaks / bottle-cherry-ssl-test.py
Created November 30, 2014 08:25
BottlePy + CherryPy SSL Test
#!/usr/bin/env python
# written by Daniel Oaks <daniel@danieloaks.net>
# generate ssl key/cert in the same dir as this script with the following commands:
# openssl genrsa -out privkey.pem 2048
# openssl req -new -x509 -days 365 -key privkey.pem -out cert.pem
import os
import bottle
import traceback
@DanielOaks
DanielOaks / nsp.py
Created March 2, 2015 17:43
Numeric String Parser using PyParsing, based off arith.py
# Numeric String Parser
# See license text in pyparsing.py
# Modifications by Daniel Oaks, same license
#
# Comply more strictly with PEP8, traditional Python style.
# Add PI and E constants.
# Add sin, cos, etc functions.
# Add power ops, ^ and **
# Split out multMap, compMap, etc for better extensibility.
@DanielOaks
DanielOaks / nodelist.py
Created March 10, 2015 03:12
Just an example nodelist function for networkx graphs. Works great, though it got factored out of my function
def nodelist(network):
"""Returns a drawable nodelist (for the concentric circle-based drawing functions of networkx)."""
# first off, find most largestly connected (hub) server for the center
center = nx.center(network)
center = center[0] # returns a list of centers, and we don't want that
# and create the layers off that
added_nodes = [center,]
@DanielOaks
DanielOaks / autoxm.py
Last active July 8, 2022 23:35
autotracker.py, for generating XM chiptunes!
#!/usr/bin/env python3
# AutoXM
# written by Daniel Oaks <daniel@danieloaks.net>
# released into the public domain
# inspired by the public domain autotracker by Ben "GreaseMonkey" Russell
import struct, random
# XM Module Handling
#
# istring tolower
import collections
# we only care about rfc1459 casemapping right now
_lower_chars = ''.join(chr(i) for i in range(91, 95))
_upper_chars = ''.join(chr(i) for i in range(123, 127))
_lower_trans = str.maketrans(_lower_chars, _upper_chars)
def irclower(in_str):
@DanielOaks
DanielOaks / yt-playlist.py
Last active June 9, 2022 03:02
Creates an m3u playlist from files downloaded using youtube-dl
#!/usr/bin/env python3
# creates an m3u playlist sorted by upload date and then name for videos
# downloaded using youtube-dl (with the --write-info-json option)
# written in 2015 by Daniel Oaks <daniel@danieloaks.net>
# released under the CC0 Public Domain license
import os
import json
from natsort import natsorted