Skip to content

Instantly share code, notes, and snippets.

View pinglunliao's full-sized avatar

pinglunliao pinglunliao

View GitHub Profile
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
multimap<int, int> nTable;
multimap<int, int>::iterator it, cur;
vector<int> result;
for(int i = 0; i < nums.size(); i++)
nTable.insert(make_pair(nums[i], i));
from tkinter import *
import tkinter.filedialog as filedialog
import tkinter.messagebox as msgbox
import pygame
import pygame.mixer as player
from enum import Enum
_BG_COLOR = 'black'
_FG_COLOR = 'red'
_FG_ALT_COLOR = 'white'
from turtle import *
import random
import time
def change_color(t):
R = random.random()
B = random.random()
G = random.random()
t.pencolor(R, G, B)
#include <NewPing.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#include<stdio.h> // 函式 printf 的 header file
#include<stdlib.h>// 函式 system 的 header file
int main(void) {
printf("嘻嘻嘻嘻嘻\n"); // 輸出文字
printf(" CCCCcc\n");
printf(" CC\n");
printf(" C\n");
printf("CC\n");
printf(" C\n");
#include <Adafruit_NeoPixel.h>
#define LDR_PIN A0
#define PIN 2 // input pin Neopixel is attached to
#define NUMPIXELS 12 // number of neopixels in Ring
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 0; // timing delay
#include <Adafruit_NeoPixel.h>
#define F_BTN_PIN 3 // forward button
#define B_BTN_PIN 4 // backward button
#define PIN 2 // input pin Neopixel is attached to
#define NUMPIXELS 24 // number of neopixels in Ring
#define HALF_NUMPIXELS 12
int ledPins[] = {2,3,4,5,6,7,8,9,10,11}; // The LED pins
int num = sizeof(ledPins) / sizeof(int);
int delayMS = 100;
void setup()
{
for (int i = 0; i < num ; i++)
{
pinMode(ledPins[i], OUTPUT);
}
int sPin = 2; // The base pin ID
int nLEDs = 10; // The number of LEDs
int delayMS = 100;
void setup()
{
for (int i = sPin; i < sPin + nLEDs; i++)
{
pinMode(i, OUTPUT);
}
@pinglunliao
pinglunliao / min-char-rnn.py
Created July 25, 2018 13:33 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)