Skip to content

Instantly share code, notes, and snippets.

View egordorichev's full-sized avatar
🖊️
Available for hire

Egor Dorichev egordorichev

🖊️
Available for hire
View GitHub Profile
@leenattress
leenattress / proc.lua
Created April 18, 2017 23:14
Pico8 perlin noise example with infinite scrolling
pico-8 cartridge // http://www.pico-8.com
version 8
__lua__
-- @gabrielcrowe
-- some perlin noise and a scrolly desert
function _init()
local f={}
local p={}
local permutation={151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
h = figure;
set(h, 'Position', [0 0 (1280+100) (720 + 100)])
WIDTH = 1280;
HEIGHT = 720;
center = [-.73659007459575,-.69270903692418];
[XX,YY] = meshgrid(linspace(0,1,720),linspace(0,1,1280));
Z = ones(size(XX));
@josefnpat
josefnpat / readme.md
Last active October 30, 2017 21:37
What is a Fantasy Console?

What is a Fantasy Console

  1. A Fantasy Console (FC) must not have existing hardware.

    E.g. The arduboy is not a fantasy console.

  2. A FC needs to have intentional restrictions not related to the hardware it is being deployed on.

    I feel adding the retro component (e.g. looks like X) to be defeating, as it might stifle the creation of new fantasy consoles. At the end of the day, a FC is based on a fantasy hardware product that is difficult to alter once released. For example; the fantasy console may only have a few MB of memory, whereas the system it is being deployed on may have GB of memory.

@coclav
coclav / gist:5760690
Last active March 11, 2019 18:43
Start the animation of a .gif on click. This adds a "start / stop" button below your still image (abc_still.gif / class : img_anim) that will change the .gif to the animated version (abc.gif)
jQuery(".img_anim").after( function() {
// keep ref to the image
var image = this;
// add div container for the link
var $d = jQuery("<div />");
// add link
var $a = jQuery("<a>Start / Stop animation</a>");
@rezoner
rezoner / pixel3d-stress-cube.js
Created March 13, 2019 09:54
PIXEL3D work in progress example
/* Code to draw a cube */
function render() {
this.camera.rotation.z += this.elapsed;
for (var x = 0; x < 64; x++) {
for (var y = 0; y < 64; y++) {
for (var z = 0; z < 64; z++) {
@texhex
texhex / DatatypeSize.ino
Created October 25, 2012 17:17
Arduino Data types
// Arduino DatatypeSize v2 - Display information about data types used in Arduino
// Created by Michael 'TeX' Hex - http://www.texhex.info/
//
// Full list of all data types:
// http://arduino.cc/en/Reference/HomePage -> Section "Data Types"
//
// Additonal references:
// http://www.arduino.cc/playground/Code/DatatypePractices
// http://arduino.cc/en/Reference/VariableDeclaration
//
@dtzxporter
dtzxporter / DiscordRpc.cs
Last active September 21, 2019 14:21
Discord Rpc .NET
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
//
// Discord Rpc Wrapper for .NET Framework (DTZxPorter) 12/26/2017
// Wrapper created using the open-source discord-rpc extension at:
function init()
white = {1, 1, 1, 1}
black = {0, 0, 0, 1}
red = {1.0, 0.1, 0.2, 1}
combine = g.newShader("combine.frag")
aesthetic = g.newShader("aesthetic.frag")
aesthetic_canvas = g.newCanvas(gw, gh)
displacement_canvas = g.newCanvas(gw, gh)
game_canvas = g.newCanvas(gw, gh)
@Gerjo
Gerjo / png-opengl
Last active April 30, 2020 13:58
Basic PNG OpenGL texture loading.
struct Textures {
static GLuint LoadPNG(const std::string& filename) {
if( ! FileExists(filename)) {
Exit("Cannot open png: %s.", filename.c_str());
}
FILE* fp = ::fopen(filename.c_str(), "r");
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@octosteve
octosteve / ImperialMarch.ino
Created October 1, 2013 22:19
Imperial march played on an Arduino with a Piezo Element
int speakerPin = 9;
int length = 70;
String notes[] = {"G4","G4", "G4", "D#4/Eb4", "A#4/Bb4", "G4", "D#4/Eb4","A#4/Bb4", "G4", "D5", "D5", "D5", "D#5/Eb5", "A#4/Bb4", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4", "G5","G4","G4","G5","F#5/Gb5", "F5","E5","D#5/Eb5","E5", "rest", "G4", "rest","C#5/Db5","C5","B4","A#4/Bb4","A4","A#4/Bb4", "rest", "D#4/Eb4", "rest", "F#4/Gb4", "D#4/Eb4","A#4/Bb4", "G4" ,"D#4/Eb4","A#4/Bb4", "G4"};
int beats[] = { 8, 8, 8, 6, 2, 8, 6 , 2 ,16 , 8, 8, 8, 6, 2, 8, 6, 2, 16,8,6,2,8,6,2,2, 2, 2,6,2,2,8,6,2,2,2,2,6,2,2,9,6,2,8,6,2,16 };
int tempo = 50;
void playTone(int tone, int duration) {
for (long i = 0; i < duration * 1000L; i += tone * 2) {
digitalWrite(speakerPin, HIGH);
delayMicroseconds(tone);