Skip to content

Instantly share code, notes, and snippets.

View Jckf's full-sized avatar

Jim C K Flaten Jckf

View GitHub Profile
#! /bin/sh
# Flush and reset.
iptables -F
iptables -X
iptables -Z
ip6tables -F
ip6tables -X
ip6tables -Z
@Jckf
Jckf / Overloads.php
Created May 23, 2018 17:13
Real method overloading in PHP
<?php
trait Overloads {
/** @var ReflectionMethod[] $olMethods **/
protected $olMethods;
/**
* Get methods from this class.
*
* Caches results to avoid recreating reflection objects for every call.
@Jckf
Jckf / luke.py
Created May 21, 2020 00:20
Reading and writing INI files in Python (for Luke Saward)
# Crude ini file reader/writer. Tries to retain original file formatting when writing.
# Author: Jim C K Flaten <jckf@jckf.no>
import os
import json
def parse_ini(filename, updates = {}):
# Prepare some variables we need.
ini = {}
section = None
@Jckf
Jckf / Yggdrasil.php
Last active July 2, 2021 02:08
PHP library for Mojang's Yggdrasil authentication system.
<?php
class Yggdrasil {
private $server = 'https://authserver.mojang.com';
private $client_token = null;
private $username = null;
private $access_token = null;
package no.jckf.slplib;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.nio.charset.Charset;
public final class MinecraftServer {
private String address = "localhost";