Skip to content

Instantly share code, notes, and snippets.

View myrkvi's full-sized avatar

Vegard Berg myrkvi

View GitHub Profile
@myrkvi
myrkvi / cde-window.markdown
Created November 10, 2022 19:38
CDE Window

Keybase proof

I hereby claim:

  • I am myrkvi on github.
  • I am vegberg (https://keybase.io/vegberg) on keybase.
  • I have a public key ASDvfsZ1PL2msVZAeAapXyRrpZNDp2gMkZ66uhJV0PnWEwo

To claim this, I am signing this object:

@myrkvi
myrkvi / comikaze.py
Last active August 24, 2016 17:11
Feel free to use this however you want, but if code from this is published, please give credit :)
#! /usr/env python3
# Dependencies:
# discord.py https://github.com/Rapptz/discord.py
# requests http://docs.python-requests.org/en/master/
import discord
import asyncio
import requests
import json
@myrkvi
myrkvi / http.go
Created February 6, 2016 12:54 — forked from donatj/http.go
Golang Basic Auth
package utils
import (
"encoding/base64"
"net/http"
"strings"
)
func BasicAuth(handler http.HandlerFunc, username, password string) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
@myrkvi
myrkvi / rpn.py
Created May 26, 2015 09:10
A terrible way of creating a RPN calculator in Python 2
# -*- coding: utf-8 -*-
from sys import argv
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
@myrkvi
myrkvi / buss.py
Created October 9, 2014 22:37
Uses AtB's "oracle" to check when buses go from places
import requests, sys
url = "https://www.atb.no/xmlhttprequest.php?service=routeplannerOracle.getOracleAnswer&question=" + " ".join(sys.argv[1:])
r = requests.get(url)
text = r.text
print(text)
@myrkvi
myrkvi / processing.html
Created March 20, 2014 11:02
Simple Processing.js template
<!DOCTYPE html5>
<html>
<head>
<script type="text/javascript" src="processing.js"> </script> <!-- Loads the Processing.js library from the same directory -->
</head>
<body>
<canvas data-processing-sources="test.pde"></canvas> <!-- This loads the file called "test.pde" in the same directory as the file" -->
</body>
</html>
@myrkvi
myrkvi / filler.rkt
Created March 10, 2014 07:12
Filler
#lang racket
(require racket/gui/base)
; Create the main window.
(define frame (new frame% [label "Filler"]
[min-width 300]
[min-height 240]
[style '(no-resize-border)]
))
; Create the status line
#lang racket
(define max (expt 100 100))
(define out (open-output-file "eee.txt"))
(define (f a b)
(if (> b max)
(f 0 1)
def isPrime(n):
if n <= 0:
return False
elif n == 1:
return False
elif n == 2:
return True
else:
for x in range(2, (n // 2) + 1 ):
if (n % x) == 0: