This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { signal, useSignal } from "@preact/signals"; | |
// zustand.. in only 15 lines :D | |
export const createStore = <T extends object>(initialState: T) => { | |
const store = signal(initialState); | |
return () => { | |
useSignal(store); | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from 'crypto' | |
// WARNING: DO NOT CHANGE THESE WITH OPEN POSITIONS | |
const PREFIX = 'X' | |
const CHARSET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ' | |
const RANDOM_LENGTH = 16 | |
const EXPRESSION = new RegExp(`^${PREFIX}-[0-9A-Z]{${RANDOM_LENGTH}}-\\d+$`) | |
// UNIQ-SEQ | |
export class PositionId { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function change(params: { from: number; to: number; factor?: 1 | 100 }) { | |
return ((params.to - params.from) / params.from) * (params.factor ?? 100) | |
} | |
export default { | |
change: change, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hashcode(object) { | |
let json = JSON.stringify(object) | |
for (var i = 0, h = 0; i < json.length; i++) | |
h = (Math.imul(31, h) + json.charCodeAt(i)) | 0 | |
return h | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"reflect" | |
"strings" | |
) | |
// Example - An example JSON-friendly struct. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# let's keep things quiet | |
touch .hushlogin | |
# make sure everything is up to date | |
sudo apt update | |
sudo apt upgrade | |
# cleanup | |
sudo apt remove telnet | |
sudo apt autoremove |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function d(p, e, t) { | |
function a(i, o) { | |
if (!e[i]) { | |
if (!p[i]) { | |
var s = "function" == typeof require && require; | |
if (!o && s) | |
return s(i, !0); | |
if (n) | |
return n(i, !0); | |
var u = new Error("Cannot find module '" + i + "'"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { exec, ExecException } from "child_process"; | |
export interface CommandResult { | |
error: ExecException; | |
stdout: string; | |
stderr: string; | |
} | |
export class Command { | |
constructor(public command: string = "") {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bukkit.plugin.java.JavaPlugin; | |
import javax.xml.bind.annotation.adapters.HexBinaryAdapter; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.InputStream; | |
import java.security.MessageDigest; | |
public class Updater implements Runnable { |