Skip to content

Instantly share code, notes, and snippets.

View Alwinfy's full-sized avatar

Alwinfy Alwinfy

  • United States
View GitHub Profile
@Alwinfy
Alwinfy / client.js
Last active October 21, 2018 17:12
A Simple(?) CLI client for Discord.
const TOKEN = null; // change this for private use
const PREFIX = '!';
const colors = +process.stdout.isTTY && process.stdout.getColorDepth();
const formats = colors ? {
'\\*\\*': [1, 22], // escape for the regex
'\\*': [3, 23],
'~~': [9, 29],
'`': [7, 27],
'__': [4, 24],
// '_': [3, 23]
import java.util.Scanner;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
public final class StringObfuscator {
public static boolean matchesHash(String str, String hash) {
@Alwinfy
Alwinfy / install-love72.sh
Last active July 17, 2019 01:47
Install LÖVE 7.2, tested on Ubuntu 19.04
#!/bin/sh
set -e
sudo apt-get install -y curl make gcc libglvnd-dev libsdl1.2-dev libopenal-dev liblua5.1-0-dev libdevil-dev libmng-dev libtiff-dev libfreetype6-dev libphysfs-dev libmodplug-dev libmpg123-dev libvorbis-dev
cd $(mktemp -d)
curl -L https://bitbucket.org/rude/love/downloads/love-0.7.2-linux-src.tar.gz |tar zxvf -
cd love-HEAD
./configure --prefix=/usr/local --program-suffix=7.2
sed -i '38i#define GL_GLEXT_PROTOTYPES' src/modules/graphics/opengl/GLee.h
make -l 2.5
sudo make install

This entry appears to be a set of papers torn out of an Elven Garde tome. While they may prove useful for learning about history, it's doubtful that they will provide any insight into the study of botany.

It has been millenia since the event known as The Shattering tore the worlds asunder. Very few know the truth of what happened on that day, and this account seeks to remedy that. It began when Nidavellir was struck by an earthquake that collapsed the majority of the realm. While the Dwarves' incredible strength and durability allowed them to survive and preserve certain things, most of their technology and culture was lost to the void between worlds.

This disturbance caused Muspelheim to break free from its tether on the World Tree herself. It crashed into the far realm of Midgard, fusing with it in a storm of fire that left no life remaining there. Many of us believe that the goddess Hel had a hand in Muspelheim's fall, but no concrete evidence was ever found.

The quak

@Alwinfy
Alwinfy / multi_array.cpp
Last active November 18, 2020 22:02
cursed multi-dim array code
#include <cstdio>
/*
template<class T>
T prod(T l) {
return l;
}
template<class T, class ...Args>
T prod(T l, Args &&...args) {
return l * prod(args...);
}*/
Entity closestToRay(Vector3 a, Vector3 b, Iterable<Entity> list) {
if(a.equals(b)) return closestToPoint(a, list);
Vec3d start = a.toVec3D();
Vec3d offset = b.toVec3D().subtract(start);
Vec3d diff = offset.normalize();
double minDot = diff.dotProduct(offset);
double minDist = Double.MAX_VALUE;
Entity found = null;
#!/usr/bin/perl -w
#perl2exe_include strict
#perl2exe_include warnings
use strict;
use warnings;
#use feature "switch";
use Env qw($MAX_RECURSION_DEPTH $AUTOCOMPILE);
use Data::Dumper;
my %words = (
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void *alloc_2d_array(size_t size, int length, int width) {
int i;
size_t offset = length * sizeof(void *);
char **block = malloc(offset + size * length * width);
*block = (char *)(block + offset);
for (i = 1; i < length; i++)
@Alwinfy
Alwinfy / main.c
Last active March 26, 2024 17:47
MANY ARRAY ONE MALLOC. NO OTHER ARRAY DO THIS FOR YOU
#include <stdio.h>
#include <stdlib.h>
extern void *alloc_nd_array(size_t, size_t, ...);
void structure_test(void) {
int i;
void **arr = alloc_nd_array(sizeof(void *), 3, 3, 2, 0);
for(i=0; i<30; i++)
printf("arr[%2d] = %18p, arr + %2d = %18p\n", i, arr[i], i, (void *)(arr + i));
@Alwinfy
Alwinfy / isbn.clj
Last active September 29, 2020 20:37
reject modernity embrace FP
(set! *warn-on-reflection* true)
(ns net.alwinfy.isbn
(:require [clojure.string :as str]))
(def checksum-for
{9 (fn [isbn]
(-> (fn [i c]
(-> i