Skip to content

Instantly share code, notes, and snippets.

import random
class Bot():
def __init__(self, money, n_tosses, odds):
self.money = money
self.n_tosses = n_tosses
self.odds = odds
def handle_toss(self, toss_result, bet_return):
pass
from microbit import *
import music
notes = ['A1', 'B1', 'C1', 'D1', 'E1', 'F1', 'G1', 'A2', 'B2', 'C2', 'D2', 'E2', 'F2', 'G2', 'A3', 'B3', 'C3', 'D3', 'E3', 'F3', 'G3', 'A4', 'B4', 'C4', 'D4', 'E4', 'F4', 'G4', 'A5', 'B5', 'C5', 'D5', 'E5', 'F5', 'G5', 'A6', 'B6', 'C6', 'D6', 'E6', 'F6', 'G6', 'A7', 'B7', 'C7', 'D7', 'E7', 'F7', 'G7']
"""
for note in notes:
music.play('{}:4'.format(note))
print('playing {}:4'.format(note))
"""
<!DOCTYPE html>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/css?family=Didact+Gothic" rel="stylesheet">
<style>
/* set the CSS */
.line {
fill: none;
stroke: steelblue;
stroke-width: 1px;
@mossbanay
mossbanay / spam.py
Last active January 14, 2016 11:01
Random spambot
import re
import random
def random_keyword(match):
keywords = match.group(1).split('|')
return random.choice(keywords)
r = re.compile(r'{([^}]+)}')
with open('comment.txt') as f:
@mossbanay
mossbanay / gist:8e6b181a3dd68756524c
Created December 10, 2015 09:09
Setup for AIOC
/* .bashrc */
alias c="clear"
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
alias r="gcc $1 && ./a.out"
/* .vimrc */
color symfony
/* swap escape and caps lock */
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'
@mossbanay
mossbanay / Sound-Alarm
Created April 6, 2015 14:40
Generate a m3u playlist from your latest likes on SoundCloud
import soundcloud
import os
import argparse
client = None
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("clientid", help="Client ID from SoundCloud")