Skip to content

Instantly share code, notes, and snippets.

@kelvneo
kelvneo / diagram2sop.py
Last active April 26, 2021 12:56
Converts State Diagram into State Table and Sum-Of-Products.
from itertools import product
from functools import reduce
from rich.console import Console
from rich.table import Table
from sympy.logic import SOPform
from sympy import symbols
storage = {}
states = ''
contract L2L {
mapping (address => uint) private userBalances;
address public owner;
bytes32 public passphrase;
bytes32 public k;
constructor(bytes32 _passphrase) public payable {
owner = msg.sender;
k = _passphrase;
passphrase = keccak256(abi.encodePacked(_passphrase));
@kelvneo
kelvneo / daybasedmultifilehandler.py
Created May 28, 2017 11:57
This gist is to handle multiple files writes that will create new files on a daily basis.
#!/usr/bin/env python
import os
import time
import logging
logging.basicConfig(level=logging.DEBUG)
import random
class DayBasedMultiFileHandler():
""" Create the new object. This class only supports `with DayBasedMultiFileHandler(...) as f:` creation.
"""
@kelvneo
kelvneo / main.java
Last active August 29, 2015 14:23
Easy Decipher for Minecraft Music
package me.deathline;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import com.google.gson.stream.JsonReader;
@kelvneo
kelvneo / index.css
Created May 25, 2015 02:05
DISM - WCD CA1 Source Code
/* Sidebar */
#sidebar {
background-color: #D1B388;
width: 19.75em;
height: 50em;
float: right;
clear: both;
border-top: 0.25em solid #795A37;
border-right: 0.25em solid #795A37;
border-bottom: 0.25em solid #795A37;
@kelvneo
kelvneo / FrostSidebar.java
Last active August 29, 2015 13:59
This is a neat way of placing a sidebar. No NMS or CraftBukkit required. It requires Guava though. You may copy the code for your own use. Github Page: https://github.com/deathline75/FrostLib
package com.frosty.frostlib;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
@kelvneo
kelvneo / ChatMsg.java
Last active January 1, 2016 04:39
ChatMsg. For a fast parsing of /tellraw thingy. It does not use JSON builders. So its fast but unreliable but still can be used. Herp derp.
package com.frosty;
import java.util.ArrayList;
import java.util.List;
public class ChatMsg {
public static class ChatPart{
public enum Colour{