This file contains hidden or 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
| """ | |
| In the book a game state is | |
| struct { | |
| int x; | |
| int y; | |
| } move | |
| Essentially this represent value, | |
| struct { | |
| int board[DIMENSION+1][DIMENSION+1]; | |
| int freecount; |
This file contains hidden or 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
| def traverse(parent): | |
| if type(parent) == list: | |
| for child in parent: | |
| for next in traverse(child): | |
| yield next | |
| elif type(parent) == dict: | |
| for child in parent: | |
| for next in traverse(parent[child]): | |
| yield next | |
| else: |
This file contains hidden or 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
| library(stringr) | |
| library(ggplot2) | |
| data <- read.csv('projects.csv') | |
| data <- data[complete.cases(data),] | |
| data <- data[which(data$tarikh_anugerah != ""),] | |
| temp <- str_split_fixed(data$tarikh_anugerah,'-',3) | |
| data$tahun <- temp[,1] | |
| target <- subset(data,as.numeric(data$tahun) > 1990 & as.numeric(data$tahun) < 2013) | |
| target$tarikh <- format(target$tarikh_anugerah,format="%Y-%m-%d") | |
| scatter <- ggplot(target,aes(x=tarikh,y=nilai))+geom_point() |
This file contains hidden or 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 inspect | |
| def test(a,b,c=None): | |
| # Don't think you need it, but do it for sake of completeness | |
| return (a,b,c) | |
| d = inspect.getargspec(test) | |
| print d.args |
This file contains hidden or 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
| //Arduino 1.0+ Only | |
| //Arduino 1.0+ Only | |
| #include "Wire.h" | |
| #define DS1307_ADDRESS 0x68 | |
| byte zero = 0x00; //workaround for issue #527 | |
| void setup(){ | |
| Wire.begin(); | |
| Serial.begin(9600); |
This file contains hidden or 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
| void setup(){ | |
| Serial.begin(9600); | |
| Serial1.begin(9600); | |
| } | |
| void loop(){ | |
| char code[10]; | |
| int bytesread = 0; | |
| while(Serial1.available() > 0){ |
This file contains hidden or 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
| #define uint8 unsigned char | |
| #define uint16 unsigned int | |
| #define uint32 unsigned long int | |
| int Clkpin = 4; | |
| int Datapin = 5; | |
| int resetFlag=0; | |
| void ClkProduce(void) |
This file contains hidden or 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
| from Tkinter import * | |
| import serial | |
| import time | |
| class RobotUI: | |
| def __init__(self,master,port): | |
| self.port = port | |
| frame = Frame(master) | |
| frame.pack() | |
| self.forward_button = Button(frame,text="Forward",command=self.move_forward) |
This file contains hidden or 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
| from bottle import Bottle | |
| from sqlalchemy import create_engine | |
| from sqlalchemy import MetaData | |
| from sqlalchemy import Table | |
| # Main Web App | |
| app = Bottle() | |
| # Configuration for sqlalchemy | |
| # source https://scraperwiki.com/scrapers/malaysian_mp_profile/ |
This file contains hidden or 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
| from pdfminer.pdfparser import PDFParser,PDFDocument | |
| from pdfminer.pdfinterp import PDFResourceManager,PDFPageInterpreter | |
| from pdfminer.pdfdevice import PDFDevice | |
| from pdfminer.layout import LAParams | |
| from pdfminer.converter import PDFPageAggregator | |
| from pdfminer.layout import LTTextBox, LTTextLine, LTFigure, LTImage, LTChar,LTTextBoxHorizontal | |
| class Document: |