This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
td { | |
color: grey; | |
border: 1px solid white; | |
padding: 0.25rem; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('node:fs'); | |
const input = String.fromCharCode(...fs.readFileSync(0)).split('\n'); | |
const source = fs.readFileSync('source.knight', 'utf8'); | |
const Knight = (() => { | |
let inputs = []; | |
let output = ''; | |
class KnightError extends Error {} | |
class ParseError extends KnightError {} | |
class RuntimeError extends KnightError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::prelude::*; | |
use bevy::render::camera::{Camera, OrthographicProjection, PerspectiveProjection}; | |
use bevy_rapier3d::prelude::*; | |
use bevy::render::pass::ClearColor; | |
use bevy_flycam::{FlyCam, PlayerPlugin}; | |
fn main() { | |
App::build() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Multiset(): | |
def __init__(self, name): | |
self.name = name | |
self.fixed_items = {} | |
self.nrof_items = 0 | |
def add(self, item): | |
self.fixed_items[item] = self.fixed_items.get(item, 0)+1 | |
self.nrof_items+=1 | |
def remove(self, item): | |
if self.fixed_items.get(item, 0) > 0: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const allowedNodeTypes = [ | |
'p', | |
'span', | |
'div', | |
'a', | |
'img', | |
'h1', | |
'h2', | |
'h3', | |
'h4', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import OpenGL.GL as GL | |
import OpenGL.GL.shaders | |
import pygame | |
import math | |
import random | |
import PIL | |
import colorsys | |
vertex_shader = """ | |
#version 330 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import json | |
import pygame | |
import random | |
# Data source: | |
# http://ec.europa.eu/eurostat/data/database?p_p_id=NavTreeportletprod_WAR_NavTreeportletprod_INSTANCE_nPqeVbPXRmWQ&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-2&p_p_col_pos=1&p_p_col_count=2# | |
# The three consituent graphs can be generated by tweaking the constants | |
# uses "abbreviations.json" from https://github.com/samayo/country-json/blob/master/src/country-by-abbreviation.json | |
# only with an added "uk" for united kingdom, since the original uses GB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
class Number: | |
def __str__(self): | |
return str(random.randint(0, 2**random.randint(1,8)+1)) | |
words = ['move', 'write', 'him', 'mark', 'gave', 'often', 'red', 'never', 'ever', 'great', | |
'second', 'money', 'old', 'keep', 'produce', 'remember', 'problem', "don't", 'laugh', 'make', | |
'might', 'beauty', 'while', 'off', 'same', 'other', 'real', 'place', 'first', 'warm', 'be', | |
'people', 'tell', 'size', 'sun', 'north', 'under', 'head', 'too', 'dog', 'differ', 'go', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python3.5 | |
import itertools | |
def isIn(group, elem): | |
elem=''.join(sorted(set(elem[0]))),''.join(sorted(set(elem[1]))) | |
for s in group: | |
if s[0]==elem[0]: | |
for g in elem[1]: | |
if g not in s[1]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#python 3.5 | |
#requires pygame and numpy | |
#loads a map from "Interactive website/worldMapBlue.png" | |
#saves result to "Interactive website/blue-world-map.png" | |
import pygame | |
import pygame.gfxdraw | |
import numpy | |
import math | |
from math import cos, sin |
NewerOlder