Skip to content

Instantly share code, notes, and snippets.

View barzamin's full-sized avatar
🌆
i continue to work. the city sleeps.

erin petra sofiya moon barzamin

🌆
i continue to work. the city sleeps.
View GitHub Profile
@barzamin
barzamin / tgp_player_stats.cs
Last active August 1, 2016 23:12
The Genesis Project player stats pseudostruct
///***!!! THIS IS NOT THE FINAL CODE NOR CODE THAT WILL GO DIRECTLY INTO THE GAME !!!***///
// It's simply a codification of the "stats" document, to make it easier for us to integrate stats when
// we start adding `Player` objects.
// I used C# because it was convenient and we want people on TGP to know it. There's no scope qualifiers etc,
// and is pretty much pseudocode, so **don't** directly copy-paste this!
// most properties should be self-explanatory
// some of the floats may need to be rolled down into ints for speed over the wire
// anything commented with (?) is of questionable necessity/usefulness and removal should be debated
struct Player {
@barzamin
barzamin / GeometryLib.java
Last active August 15, 2016 17:39
Processinglang/Java computational geometry utils
import megamu.mesh.*;
static class GeomUtils {
static PVector centroid(MPolygon polygon) {
return centroid(toVectorArray(polygon.getCoords()));
}
static PVector centroid(PVector[] polygon) {
int l = polygon.length;
float a = signedArea(polygon);

this is going to be a review of the current genesis demo build by erin/barzamin/The Refactor Godess/The Really Annoying Nitpicker

ok lets boot it up bluh

wine Genesis.exe

cool it runs ok under wine

let's do "good" graphics quality, and make it windowed

#!/usr/bin/python2
import requests
import os
import sys
import random
import string
FILTERS = [
"smile",
"smile_2",
@barzamin
barzamin / discord_auth.py
Created June 5, 2017 22:02
Discord auth blueprint for Flask
from requests_oauthlib import OAuth2Session
from flask import Blueprint, request, redirect, abort, flash, url_for, session
from flask_login import login_user, logout_user, login_required
from www import app, db, login_manager
from .models import User
from .utils import is_safe_redirect
API_BASE_URL = 'https://discordapp.com/api'
OAUTH2_CLIENT_ID = app.config['DISCORD_CLIENT_ID']
/// a collection of cool colormaps in glsl
/// most work on [0, 1].
///
/// Lovingly ripped off from:
/// * halcy
/////////////////////////////////////////////////////////////////
// WAHas Spectrum analyzer palette
// ripped off from https://www.shadertoy.com/view/MstSzj
use arch::x86_64::ports::Port;
use core::fmt;
use spin::RwLock;
lazy_static! {
pub static ref COM1: RwLock<SerialPort> = RwLock::new(SerialPort::new(0x3f8));
}
pub struct SerialPort {
data_port: Port<u8>,
vec4 viridis(float x) {
const float e0 = 0.0;
const vec4 v0 = vec4(0.26666666666666666,0.00392156862745098,0.32941176470588235,1);
const float e1 = 0.13;
const vec4 v1 = vec4(0.2784313725490196,0.17254901960784313,0.47843137254901963,1);
const float e2 = 0.25;
const vec4 v2 = vec4(0.23137254901960785,0.3176470588235294,0.5450980392156862,1);
const float e3 = 0.38;
const vec4 v3 = vec4(0.17254901960784313,0.44313725490196076,0.5568627450980392,1);
const float e4 = 0.5;
/// thanks to @no_boot_device@twitter.com
webpackJsonp([0],[function(n,b,d){mArr=d.m,mCac=d.c,mCar=[],Object.keys(mCac).forEach(function(n){mCar[n]=mCac[n]}),findFunc=function(n){if(results=[],"string"==typeof n)mArr.forEach(function(r,t){-1!==r.toString().indexOf(n)&&results.push(mCac[t])});else{if("function"!=typeof n)throw new TypeError("findFunc can only find via string and function, "+typeof n+" was passed");modArray.forEach(function(r,e){n(r)&&results.push(t.c[e])})}return results},findCache=function(n){if(results=[],"function"==typeof n)mCar.forEach(function(r,t){n(r)&&results.push(r)});else{if("string"!=typeof n)throw new TypeError("findCache can only find via function or string, "+typeof n+" was passed");mCar.forEach(function(r,t){if("object"==typeof r.exports)for(p in r.exports)if(p==n&&results.push(r),"default"==p&&"object"==typeof r.exports["default"])for(p in r.exports["default"])p==n&&results.push(r)})}return results},window.wc={get:d,modArr:mArr,modCache:mCac,modCArr:mCar,findFunc:findFunc,find

Keybase proof

I hereby claim:

  • I am barzamin on github.
  • I am er1n (https://keybase.io/er1n) on keybase.
  • I have a public key ASBGM6pIaiBnGcv7QvY5gqnhIf9cqGJm7oJUKx8ug82D5wo

To claim this, I am signing this object: