Skip to content

Instantly share code, notes, and snippets.

View JialunC's full-sized avatar

Thomas C JialunC

  • in a galaxy far, far away
View GitHub Profile
@JialunC
JialunC / Permutations.java
Created June 28, 2020 20:57
permutations
/**
* Write a description of class Permutations here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Permutations
{
// instance variables - replace the example below with your own
---
title: "cind110_Assignment_02"
author: "Write your name here"
due: "March 13, 2020"
output:
html_document:
df_print: paged
pdf_document: default
word_document: default
---
@JialunC
JialunC / assignment.sql
Created March 11, 2020 02:49
assignment
CREATE DATABASE IF NOT EXISTS `LibraryDB` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `LibraryDB`;
-- MySQL dump 10.13 Distrib 8.0.17, for macos10.14 (x86_64)
--
-- Host: localhost Database: LibraryDB
-- ------------------------------------------------------
-- Server version 5.7.17
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@JialunC
JialunC / test.sql
Created February 10, 2020 23:52
ok
CREATE DATABASE IF NOT EXISTS `LibraryDB` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `LibraryDB`;
-- MySQL dump 10.13 Distrib 8.0.17, for macos10.14 (x86_64)
--
-- Host: localhost Database: LibraryDB
-- ------------------------------------------------------
-- Server version 5.7.17
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
!J INC:0001438823:
#1 A LIFESAFER HOLDINGS, INC.:0001509607:
#1 ARIZONA DISCOUNT PROPERTIES LLC:0001457512:
#1 PAINTBALL CORP:0001433777:
$ LLC:0001427189:
ZZX, LLC:0001691924:
ZZYZX ZZAZX ZZOZX INC:0001184274:
ZZZ MEDIA HOLDINGS, INC.:0001755250:
@JialunC
JialunC / async_example.js
Created March 7, 2018 03:41
Asynchronous tasks and callbacks from Lynda Learning Node.js
// this is a sync-demo
fs = require('fs')
data = fs.readdirSync('c:/')
console.log(data)
console.log('this is the data')
// this is a async-demo
fs = require('fs')
import request
import numpy as np
import time
import json
todaysdate = time.strftime("%Y-%m-%d-%H-%M")
lat_list = list(np.arange(43.639613, 43.726960, 0.01))
lng_list = list(np.arange(-79.343137, -79.458181, -0.01))
data = dict()
for lat in lat_list:
@JialunC
JialunC / request.py
Created December 20, 2017 04:09
Dropbike nearby bikes HTTP request
import requests as r
import config
def find_bikes(lat,lng):
result = dict()
endpoint = "https://dropbikeadminapi.herokuapp.com/v1/bikes_nearby"
data = {"lat":lat,"lng":lng}
headers = {"Authorization":config.drop_bike_token,'Content-Type':'application/json','User-Agent':'dropbike/1.9.5 (iPhone; iOS 11.2; Scale/2.00)','Accept-Encoding': 'br, gzip, deflate','X-Dropbike-Platform':'iOS','X-Dropbike-Version':'1.9.5'}
# if SSLError: ("bad handshake: Error([('SSL routines', 'SSL23_GET_SERVER_HELLO', 'sslv3 alert handshake failure')],)",) occurs
# uncomment the following line
@JialunC
JialunC / async_code_2.py
Last active October 8, 2020 03:12
Async_code_2 for downloading json (with aiofiles)
import asyncio
import aiohttp
# import json
import aiofiles
import config
async def store_json_2(symbol):
print(f'============downloading {symbol} json data ============')
payload = {
'function': 'TIME_SERIES_DAILY_ADJUSTED',
@JialunC
JialunC / async_code_1.py
Last active March 22, 2018 13:23
Async_code_1 for downloading json (w/o aiofiles)
import asyncio
import aiohttp
import json
# import aiofiles
import config
# ============== async function 1 ===============
async def store_json_1(symbol):
print(f'============downloading {symbol} json data ============')
payload = {