Skip to content

Instantly share code, notes, and snippets.

View Justasic's full-sized avatar
🏍️
Making computers do things they don't want to

NightShadow Justasic

🏍️
Making computers do things they don't want to
View GitHub Profile
@Justasic
Justasic / inizh.patch
Last active July 8, 2019 00:25
This patches Command & Conquer: Generals Zero Hour's inizh.big file to create a GLA super worker which can build all the command centers of all factions (basically a huge cheat)
diff -r -u /tmp/Data/INI/CommandButton.ini /DataStorage/Games/Data/INI/CommandButton.ini
--- /tmp/Data/INI/CommandButton.ini 2019-07-05 21:57:33.363905699 -0700
+++ /DataStorage/Games/Data/INI/CommandButton.ini 2019-07-05 21:54:43.440602319 -0700
@@ -2632,6 +2632,15 @@
DescriptLabel = CONTROLBAR:ToolTipGLABuildWorker
End
+CommandButton Command_ConstructGLASpecialWorker
+ Command = UNIT_BUILD
+ Object = GLASpecialInfantryWorker
@Justasic
Justasic / ruleset.xml
Created May 26, 2019 05:26
CIA Ruleset
<formatter medium="irc">
<format appliesTo="CommitToIRC">
<color fg='red'><project/>:</color>
<color fg='orange'><author/> *</color>
<b>[<branch/>]</b>
<autoHide><b><version/></b></autoHide>
<color fg='yellow'>r<b><revision/></b></color> |
<color fg='aqua'>/<files/></color><b>:</b>
<log/>
@Justasic
Justasic / LogBot.py
Last active June 15, 2019 10:02
a super basic Discord chat logging bot
#!/usr/bin/env python3
# coding: utf-8
"""
Discord logging bot for logging basic channel messages.
Based on work by:
LogBot
@Justasic
Justasic / Safeatoi.cpp
Last active October 15, 2018 02:22
Just a simple character to integer conversion function with bounds checking
template<typename T> T safeatoi(const char *buffer, size_t len)
{
T returnval = 0;
// parse each char and get the int value.
for (size_t i = 0; i < len; ++i)
{
char ch = buffer[i];
T value = ch - '0';
@Justasic
Justasic / EarthQuakes.py
Created October 3, 2018 08:04
This is my script I use for my IRC channel that announces different earthquakes around the world
#!/usr/bin/env python3
import requests, json, time, feedparser, re
from datetime import datetime
from dateutil.parser import parse
from humanize import naturaltime
import shorturl
# This script parses the JSON data from https://earthquake.usgs.gov/fdsnws/event/1/
# and data from https://www.emsc-csem.org/service/rss/rss.php?typ=emsc
# and displays two feeds, one is to the #Earthquakes.all channel and the other
# is in the #Earthquakes.major channel.
@Justasic
Justasic / garbagefilemaker.c
Last active September 20, 2018 06:16
How fast can you write a file in C?
/*
* Written by Justin Crawford
* Compile with: clang -Wall -Wextra -O3 -D_FORTIFY_SOURCE=2 -march=native -o main main.c
*/
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
@Justasic
Justasic / kstring.h
Last active September 10, 2018 07:38
kstring -- The C++ string class with extra features std::string does not include
/*************************************************************************
* BSD 2-Clause License
*
* Copyright (c) 2017-2018, Justin Crawford
* Copyright (c) 2017, William Haugen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
@Justasic
Justasic / URLShortener.py
Last active August 1, 2018 19:16
Actually URLShortener.tac but no syntax highlighting. This is an entire website for storing and redirecting URLs in a simple way. Post JSON to the site and it stores it, give someone a link and it redirects them.
#!/usr/bin/twistd3 -noy
import sqlite3, json, os
from twisted.application import service, internet
from twisted.web import static, server, proxy
from twisted.internet import reactor
from twisted.python import log
from klein import Klein
@Justasic
Justasic / RapidCheckouts.cpp
Last active July 6, 2018 11:58
The same as RapidCheckouts.py but written in pure C++ to remove the python dependencies (makes it more portable)
/* MIT License
*
* Copyright (c) 2018 Justin Crawford <Justin@stacksmash.net>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
@Justasic
Justasic / Simplex.cpp
Created May 16, 2018 00:53
A dumb program to interpret the serial protocol for my Simplex fire panel
/*
* Main.cpp
*
* Created on: 9-Jan-2009
* Author: root
*/
/////////////////////////////////////////////////
// Serial port interface program //