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
""" | |
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 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 requests | |
import csv | |
import dateparser | |
api_key="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InN3ZWVtZW5nIiwicmVhZF93cml0ZSI6ZmFsc2UsImlhdCI6MTU1MzIxMzkxMn0.PRofXuak0Do6hmn6rdulxmeIIZBV9P0GJbdTPe0IvZU" | |
dev_url="https://api.favoriot.com/v1/devices" | |
one_dev_url="https://api.favoriot.com/v1/devices/{dev_id}" | |
data_url_tmpl="https://api.favoriot.com/v1/devices/{dev_id}/streams" |
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
from m5stack import * | |
from m5ui import * | |
import urequests | |
import network | |
lcd.clear() | |
wlan = network.WLAN(network.STA_IF) | |
wlan.active(True) | |
wlan.connect("blergh", "blergh") | |
while not wlan.isconnected(): |
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
{"ssid":"eatme", "password":"blergh", "apikey":"WhatKey?Monkey!", "device_id":"SniffSniff"} |
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
from m5stack import * | |
from m5ui import * | |
from machine import UART | |
import time | |
import struct | |
# This is the only UART that works. | |
uart2 = UART(1, tx=17, rx=16) | |
uart2.init(9600) | |
while True: |
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 pandas | |
def processor(file_name): | |
df = pandas.read_excel(file_name, skiprows=1) | |
# drop bad column | |
columns = df.columns | |
for column in columns: | |
if "Unnamed" in column: | |
df = df.drop(column, axis=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
from keras import models | |
from keras import layers | |
def model(training_data, training_label, epochs=20): | |
model = models.Sequential() | |
model.add(layers.Dense(16, activation='relu', input_shape=(10000,))) | |
model.add(layers.Dense(16, activation='relu')) | |
model.add(layers.Dense(1, activation='sigmoid')) | |
model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy']) | |
model.fit(x_train, y_train, epochs=epochs, batch_size=512) |
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 pandas as pd | |
import os | |
def main(): | |
df = pd.read_csv("./bptms_Employed_persons_by_educational_attainment_state-1.csv") | |
if not os.path.exists("image_dir"): | |
os.makedirs("image_dir") | |
for s in df["State/Country"].unique(): |
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 55 columns, instead of 44. in line 4.
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
PELABUHAN KLANG - TANJUNG MALIM,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | |
NO.TREN / TRAIN NUMBER,2104,2106,2340,2304,2306,2108,2308,2110,2112,2342,2114,2310,2116,2118,2312,2120,2344,2122,2124,2314,2126,2346,2128,2130,2316,2132,2348,2134,2318,2320,2136,2138,2350,2140,2322,2142,2144,2324,2146,2148,2150,2352,2152,2154,2156,2158,2160,2354,2326,2162,2328,2164,2166,2330 | |
PEL. KLANG,05:10,05:43,05:50,,,06:13,,06:40,07:10,,07:40,,08:15,08:40,,09:17,,09:40,10:32,,11:05,,11:40,12:23,,13:05,,13:40,,,14:35,15:05,,15:40,,16:05,16:13,,16:40,16:55,17:10,,17:43,18:02,18:15,18:45,19:25,,,20:05,,20:47,21:25, | |
JALAN KASTAM,05:17,05:50,05:57,,,06:20,,06:47,07:17,,07:47,,08:22,08:47,,09:24,,09:47,10:39,,11:12,,11:47,12:30,,13:12,,13:47,,,14:42,15:12,,15:47,,16:12,16:20,,16:47,17:02,17:17,,17:50,18:09,18:22,18:52,19:32,,,20:12,,20:54,21:32, | |
KG RAJA UDA,05:20,05:53,06:00,,,06:23,,06:50,07:20,,07:50,,08:25,08:50,,09:27,,09:50,10:42,,11:15,,11:50,12:33,,13:15,,13:50,,,14:45,15:15,,15:50,,16:15,16:23,,16:50,17:05,17:20,,17:5 |
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 56 columns, instead of 10. in line 6.
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
TANJUNG MALIM - PELABUHAN KLANG,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, | |
NO.TREN / TRAIN NUMBER,2341,2103,2105,2309,2107,2109,2311,2111,2113,2313,2115,2315,2343,2117,23172119,2121,2123,2321,2345,2125,2127,2323,2129,2347,2325,2131,2133,2327,2135,2349,2137,2139,2329,2141,2351,2143,2331,2145,2147,2149,2353,2151,2333,2153,2155,2335,2157,2355,2159,2337,2161,2339,2163,2165, | |
TANJUNG MALIM,,,05:15,05:30,,05:50,,,06:05,06:25,,07:20,,,08:38,,,,10:15,,,,11:52,,,12:40,,,13:55,,,,,15:40,,,,16:45,,,,,,19:00,,,20:00,,,,21:00,,22:00,, | |
KUALA KUBU BARU,,,05:31,05:46,,06:06,,,06:21,06:41,,07:36,,,08:54,,,,10:31,,,,12:11,,,12:56,,,14:11,,,,,15:56,,,,17:01,,,,,,19:16,,,20:16,,,,21:16,,22:16,, | |
RASA,,,05:37,05:52,,06:12,,,06:27,06:47,,07:42,,,09:00,,,,10:37,,,,12:17,,,13:02,,,14:17,,,,,16:02,,,,17:07,,,,,,19:22,,,20:22,,,,21:22,,22:22,, | |
BATANG KALI,,,05:42,05:57,,06:17,,,06:32,06:52,,07:47,,,09:05,,,,10:42,,,,12:22,,,13:07,,,14:22,,,,,16:07,,,,17:12,,,,,,19:27,,,20:27,,,,21:27,,22:27,, | |
SERENDAH,,,05:52,06:07,,06:27,,, |