Skip to content

Instantly share code, notes, and snippets.

View mai1015's full-sized avatar

mai1015

View GitHub Profile
@mai1015
mai1015 / db
Last active June 26, 2020 15:21
group: nameOfTheNewGroup
Country = {
country_id:number,country_name:string
1, US
2, CAN
3, CHINA
}
city = {
@mai1015
mai1015 / gist:0c55f3801d36e4ef3dff91db5c52cdae
Last active October 12, 2019 02:36
EECS3421 ass1 test data
-- this is an example
group: nameOfTheNewGroup
Country = {
CTRYID:string, name:string
US, UNITED_STATES
CAN, CANADA
CN, CHINA
// include the library code:
#include <LiquidCrystal.h>
#include <Wire.h>
//
#define BUTTON_PIN 7
#define RELAY_PIN 13
#define B_PIN 9
#define FILL_TIME 30 //second
// VARIABLE
@mai1015
mai1015 / servo.ino
Last active September 21, 2017 19:46
Servo button example
#include <Servo.h>
// Declear the servo
Servo myservo;
// Declear pins
const int buttonPin = 2;
const int servoPin = 13;
// Declear variables
int lastButtonState = LOW;
int bottonState = LOW;
@mai1015
mai1015 / main.c
Last active July 12, 2017 06:09
Easy Knuth–Morris–Pratt (KMP) with C
//just new to C
//other example: http://code.activestate.com/recipes/577908-implementation-of-knuthmorrispratt-algorithm/
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <memory.h>
bool is_substring(const char *haystack, const char *needle) {
int m=0, i=0;
int hsize = strlen(haystack);