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
# Poker Hand Analyser Library for Project Euler: Problem 54 | |
from collections import namedtuple | |
suits = "h,d,c,s".split(",") | |
faces = "2,3,4,5,6,7,8,9,T,J,Q,K,A" | |
face = faces.split(',') | |
class Card(namedtuple('Card', 'face, suit')): | |
def __repr__(self): |
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 | |
def at_bat(hitter): | |
if (random.random() < hitter['avg']): | |
return 'ON' | |
else: | |
return 'OUT' | |
def inning(): |
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
using System; | |
using System.Collections.Generic; | |
using System.Security.Cryptography; | |
using System.Text; | |
// https://gist.github.com/ecounysis/7889b67704a26f26369399a636105233 | |
// https://netsuite.custhelp.com/app/answers/detail/a_id/42169/kw/C%23%20>%20RESTlet%20Authentication%20Using%20Token%20(Token-Based%20Authentication) | |
namespace OAuth | |
{ |
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
#!/usr/bin/perl | |
# | |
# Markdown -- A text-to-HTML conversion tool for web writers | |
# | |
# Copyright (c) 2004 John Gruber | |
# <http://daringfireball.net/projects/markdown/> | |
# | |
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 re | |
class Book: | |
def __init__(self, desc): | |
ba = desc.split(" by ") | |
self.title = ba[0] | |
self.author = ba[1] | |
books = [] |
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
# I wrote this after I answered this question on SO | |
# http://stackoverflow.com/q/40663103/102022 | |
def hangman(word): | |
word = word.lower() | |
right_letters = [] | |
wrong_letters = [] | |
def guess(letter): | |
letter = letter.lower() | |
if letter in right_letters or letter in wrong_letters: |
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
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#define MAXSIZE 65536 | |
char pw[MAXSIZE]; | |
void print_usage(); | |
int randomizebuff(char *buff, int start, int end, int buffsize); | |
int number(char *st); |
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
// Copyright (c) 2016 Eric Christensen | |
/* | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this | |
software and associated documentation files (the "Software"), to deal in the Software | |
without restriction, including without limitation the rights to use, copy, modify, merge, | |
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | |
to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies | |
or substantial portions of the Software. |
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
a: | |
b: | |
COPYFROM 9 | |
COPYTO 2 | |
INBOX | |
COPYTO 0 | |
JUMPZ f | |
INBOX | |
COPYTO 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
a: | |
b: | |
INBOX | |
COPYTO 0 | |
OUTBOX | |
c: | |
COPYFROM 0 | |
JUMPZ a | |
JUMPN e | |
BUMPDN 0 |
NewerOlder