Skip to content

Instantly share code, notes, and snippets.

@fluffels
fluffels / sphere.C
Last active August 29, 2015 13:57
HOWTO: Create sphere geometry using trigonometry.
/* The amount to change the angle by with each step, determined by
resolution.*/
const float ANGLE_DELTA = (float)REVOLUTION / (float)_resolution;
/* Convert the delta to radians, since that's what C++ works in. */
const float R_ANGLE_DELTA = ANGLE_DELTA * (float)M_PI / 180.0f;
/* Allocate vertices for each step along the x-axis. */
_vertexCount = (int) ceilf(abs(X_ANGLE_STOP - X_ANGLE_START) / ANGLE_DELTA);
/* Allocate vertices for each step along the y-axis. */
_vertexCount *= (int) ceilf(abs(Y_ANGLE_STOP - Y_ANGLE_START) / ANGLE_DELTA);
@fluffels
fluffels / Makefile
Last active August 29, 2015 14:03
Dumb make system that recompiles updated LESS files.
SOURCE_FILES=main.less
SOURCE_PATH=src/less/
TARGET_PATH=css/
SOURCES=$(addprefix ${SOURCE_PATH}, ${SOURCE_FILES})
SOURCES_AND_LIBS=$(shell find ${SOURCE_PATH} -name '*.less')
TARGETS=$(addprefix ${TARGET_PATH}, $(addsuffix .css, $(basename ${SOURCE_FILES})))
@fluffels
fluffels / gist:53cd7b0a466e41c8ff79
Last active March 28, 2019 22:26
Byobu Cheatsheet
  • Split vertically: Ctrl-a %
  • Split horizontally: Ctrl-a \
  • Switch between splits: Ctrl-a o | Ctrl-a [left | right | up | down]
  • Swap splits: Ctrl-a Ctrl-o
  • Start a new session: byobu -S session-name
  • Resize: Ctrl-a [Ctrl | Alt]-[left | right | up | down]
@fluffels
fluffels / mock-kickbox-io.js
Created September 1, 2015 21:29
Mock out kickbox.io service
var http = require("http");
var url = require("url");
var listen_port = 49153;
var listen_ip = "127.0.0.1";
var headers = {
"Content-Type": "application/json"
}
@fluffels
fluffels / mock_panacea.py
Created November 30, 2015 14:50
Panacea Mock Server
from datetime import datetime
from BaseHTTPServer import HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
import urllib
from uuid import uuid4
import json
@fluffels
fluffels / .vimrc
Created June 12, 2016 09:52
No-plugin .vimrc
noremap <leader>[ :bp<CR>
noremap <leader>] :bn<CR>
"Indentation settings.
set autoindent
set shiftwidth=4
set expandtab
set tabstop=4
set softtabstop=4
@fluffels
fluffels / .ideavimrc
Created August 20, 2016 07:30
IntelliJ .vimrc
"Keep context visible at all times.
set scrolloff=5
set sidescrolloff=5
"All-lower case searches will be case-insensitive, if there's one upper case
"letter, it will be case-sensitive.
set ignorecase
set smartcase
"Set Vim to globally substitute by default.
# Defined interactively
function fish_prompt --description 'Informative prompt'
#Save the return status of the previous command
set -l last_pipestatus $pipestatus
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
if functions -q fish_is_root_user; and fish_is_root_user
printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root
and set_color $fish_color_cwd_root
or set_color $fish_color_cwd) \