Skip to content

Instantly share code, notes, and snippets.

View kaikiat's full-sized avatar
🏗️
Building

Kai Kiat Poh kaikiat

🏗️
Building
View GitHub Profile
// This is full code for App.js
import {
StartScreen,
LoginScreen,
RegisterScreen,
ResetPasswordScreen,
Dashboard,
} from './src/screens'
import React from 'react';
// This is full code for App.js
import {
StartScreen,
LoginScreen,
RegisterScreen,
ResetPasswordScreen,
Dashboard,
} from './src/screens'
import React from 'react';
@kaikiat
kaikiat / main.py
Created January 12, 2020 09:05
Telegram Bot inline keyboard to prompt user for their email as well as to verify their email using regex
def check_email(email):
regex = '^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$'
if(re.search(regex,email)):
print("Valid Email")
return True
else:
print("Invalid Email")
return False
@kaikiat
kaikiat / main.py
Created January 12, 2020 08:22
Telegram Bot inline keyboard to prompt user for the time for their apppointment
def sendInlineMessageForBookingTime(chat_id):
text_message='Please choose a time slot...'
current_time=datetime.datetime.now()
current_hour=str(current_time)[11:13]
# ----------- Chunk of if statement to determine which inline keyboard to reply user ----------------
if int(current_hour) < 8:
keyboard={'keyboard':[
[{'text':'08:00'}],[{'text':'10:00'}],
[{'text':'12:00'}],[{'text':'14:00'}],
[{'text':'16:00'}],[{'text':'18:00'}],
@kaikiat
kaikiat / main.py
Created January 12, 2020 08:15
Telegram Bot inline keyboard to prompt user for the service that they require
def sendInlineMessageForService(chat_id):
text_message='Hi! I am your Hair Sylist Bot!\nI can help you book an appointment.\n\nYou can control me using these commands\n\n/start-to start chatting with the bot\n/cancel-to stop chatting with the bot.\n\nFor more information please contact automationfeed@gmail.com'
keyboard={'keyboard':[
[{'text':'Cut'},{'text':'Dye'}],
[{'text':'Perm'},{'text':'Reborn'}]
]}
key=json.JSONEncoder().encode(keyboard)
url='https://api.telegram.org/bot'+str(api_key)+'/sendmessage?chat_id='+str(chat_id)+'&text='+str(text_message)+'&reply_markup='+key
response = requests.get(url)
return response
@kaikiat
kaikiat / schdulder.py
Created January 12, 2020 07:53
Script to schedule events in Google-Calendar
from __future__ import print_function
import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
# SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
@kaikiat
kaikiat / main.py
Created January 11, 2020 13:34
Template Code for Telegram Bot
import requests
import datetime
import json
api_key='your_api_key'
def run():
url = "https://api.telegram.org/bot{}/getUpdates".format(api_key)
response = requests.get(url)
data=response.json()
@kaikiat
kaikiat / ma.py
Created October 6, 2019 15:51
Function to plot 200-day MA and 100-day MA
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web
def plot_ma(ticker,start,end):
style.use('ggplot')
df=web.DataReader(ticker,'yahoo',start,end)
@kaikiat
kaikiat / plot_graph.py
Created October 6, 2019 14:47
Function to plot a stock's closing price against time
import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web
def show_closing_price(ticker,start,end):
style.use('ggplot')
df=web.DataReader(ticker,'yahoo',start,end)
const express = require('express');
const save = require('instagram-save');
const app = express();
app.get('/download', (req,res) => {
var URL = req.query.URL;
var myDir='/Users/kaikiat/Programming/youtube_dld'; //your_path
var splitted_URL=URL.split("/"); ///returns an array
var array_length=splitted_URL.length;
insta_photo_id=splitted_URL[array_length-2]