Skip to content

Instantly share code, notes, and snippets.

View veganaize's full-sized avatar

veganaiZe veganaize

View GitHub Profile
@veganaize
veganaize / middleman.c
Last active June 20, 2021 21:10
Replace character in stream
#include <stdio.h>
int main(int argc, char **argv)
{
int c;
FILE *fp = stdin;
/* Input filename on command line ? */
if (argc > 1) {
fp = fopen(argv[1], "r");
@veganaize
veganaize / webserver.js
Last active September 13, 2020 11:52
Most basic Node.js web server
var fs = require('fs');
require('http').createServer(function(request, response) {
var path = 'public_html'+ request.url.slice(0,
(request.url.indexOf('?')+1 || request.url.length+1) - 1);
fs.stat(path, function(bad_path, path_stat) {
if (bad_path) respond(404);
else if (path_stat.isDirectory() && path.slice(-1) !== '/') {
response.setHeader('Location', path.slice(11)+'/');
@veganaize
veganaize / Organization.java
Last active April 23, 2020 03:13
Simplistic Organization
import java.util.ArrayList;
public class Organization {
String name;
String address;
ArrayList<Person> persons = new ArrayList<>();
ArrayList<Department> departments = new ArrayList<>();
}
@veganaize
veganaize / css_dejank.html
Last active August 30, 2019 18:11
CSS de-jank (originally by Hunter Logan)
<!DOCTYPE html>
<head>
<!-- Originally implemented by Hunter Logan -->
<style>
body {
visibility: hidden;
opacity: 0;
-webkit-animation: fadein .6s; /* Safari, Chrome and Opera > 12.1 */
-moz-animation: fadein .6s; /* Firefox < 16 */
@veganaize
veganaize / index.html
Created March 27, 2019 17:08
greed sim-1 created by veganaiZe - https://repl.it/@veganaiZe/greed-sim-1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="stage"></div>
@veganaize
veganaize / index.html
Created March 24, 2019 19:42
greed sim created by dustinwoods - https://repl.it/@dustinwoods/greed-sim
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="stage"></div>
@veganaize
veganaize / index.html
Created March 24, 2019 19:42
greed sim created by dustinwoods - https://repl.it/@dustinwoods/greed-sim
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="stage"></div>
@veganaize
veganaize / test_ansi.py
Created June 17, 2017 00:42 — forked from ssbarnea/test_ansi.py
ANSI support detection code for Python.
#!/usr/bin/env python
import sys, os, time, platform
sample_ansi = '\x1b[31mRED' + '\x1b[33mYELLOW' + '\x1b[32mGREEN' + '\x1b[35mPINK' + '\x1b[0m' + '\n'
for handle in [sys.stdout, sys.stderr]:
if (hasattr(handle, "isatty") and handle.isatty()) or \
('TERM' in os.environ and os.environ['TERM']=='ANSI'):
if platform.system()=='Windows' and not ('TERM' in os.environ and os.environ['TERM']=='ANSI'):