Skip to content

Instantly share code, notes, and snippets.

View kirkegaard's full-sized avatar

Christian Kirkegaard kirkegaard

View GitHub Profile
@kirkegaard
kirkegaard / tamagotchi.py
Last active April 11, 2024 08:42
a tamagotchi simulator in python
import os
import time
import sched
import threading
import inquirer
class Tamagotchi:
age = 0
bored = 0
@kirkegaard
kirkegaard / guess.js
Last active April 5, 2024 21:41
Name this decent modder. A guessing game in node
const readline = require('node:readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const HIDDEN_CHAR = "_";
const words = [
@kirkegaard
kirkegaard / scrollable.html
Created January 4, 2024 20:06
Horizontal scrollable container with fadeout
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
const canvas = document.querySelector('#canvas');
const ctx = canvas.getContext('2d');
let windowWidth = window.innerWidth;
let windowHeight = window.innerHeight;
const onResize = () => {
canvas.width = windowWidth = window.innerWidth;
canvas.height = windowHeight = window.innerHeight;
};

Japan

Before you go

You can do a lot before you actually go! Like renting an internet dongle, grab tickets for the places you want to go or simply place stars on a google map. Its a good idea to plan where you want to go. Everything is huge so you'll wanna plan out before going out. And remember to drink a lot of water!

Internet

I cant stress this enough. Get an internet dongle! You can get these all around but look through the internet for cheap dongles. You can get these in the airport but its pretty expensive and the dataplans aint that good.

@kirkegaard
kirkegaard / opengl_vs_directx.mdown
Created June 30, 2011 00:17
The Tale of OpenGL vs. Direct3D

The Tale of OpenGL vs. Direct3D

Many of the answers here are really, really good. But the OpenGL and D3D issue should probably be addressed. And that requires... a history lesson.

And before we begin, I know far more about OpenGL than I do about Direct3D. I've never written a line of D3D code in my life, and I've written tutorials on OpenGL. So what I'm about to say isn't a question of bias. It is simply a matter of history.

Birth of Conflict

One day, sometime in the early 90's, Microsoft looked around. They saw the SNES and Sega Genesis being awesome, running lots of action games and such. And they saw DOS. Developers coded DOS games like console games: direct to the metal. Unlike consoles however, where a developer who made an SNES game knew what hardware the user would have, DOS developers had to write for multiple possible configurations. And this is rather harder than it sounds.

@kirkegaard
kirkegaard / dumpoverssh.sh
Created December 20, 2010 11:33
pipe a mysql dump through gzip and send it over ssh
mysqldump -u MYSQL_USERNAME -p YOUR_DATABASE | gzip -c | ssh USERNAME@YOUR_TO_HOST 'cat > ~/dump.sql.gz'
@kirkegaard
kirkegaard / sync.rb
Created July 19, 2011 00:18
quick and dirty rsync backup script in ruby
#!/usr/bin/env ruby
require 'colored'
dest = '/Volumes/Drobo/BACKUP/'
logfile = '.sync/log'
folders = [
'~/Development',
'~/Documents',
'~/Pictures',
'~/Music',
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Typeout</title>
<style>
body, html {
margin: 0;
padding: 0px;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
const endpoint = "https://api.covid19api.com/world/total";
const fetchData = async () => {