Skip to content

Instantly share code, notes, and snippets.

View buildingwatsize's full-sized avatar
🧘‍♂️
Meditating

Chinnawat Chimdee buildingwatsize

🧘‍♂️
Meditating
View GitHub Profile
@buildingwatsize
buildingwatsize / eternalblue8_exploit.py
Created May 18, 2017 01:00 — forked from worawit/eternalblue8_exploit.py
Eternalblue exploit for Windows 8/2012
#!/usr/bin/python
from impacket import smb
from struct import pack
import os
import sys
import socket
'''
EternalBlue exploit for Windows 8 and 2012 by sleepya
The exploit might FAIL and CRASH a target system (depended on what is overwritten)
@buildingwatsize
buildingwatsize / API.md
Created May 26, 2017 05:10 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@buildingwatsize
buildingwatsize / cloudSettings
Last active April 9, 2021 01:54
Visual Studio Code Settings Sync Gist
{"lastUpload":"2021-04-09T01:54:44.644Z","extensionVersion":"v3.4.3"}
@buildingwatsize
buildingwatsize / colly-harvest-core.go
Created July 16, 2020 07:08
Core Code for Harvesting Data from ทองคำราคา.com via Colly
...
c := colly.NewCollector()
c.OnHTML(GoldtradersTableElement, func(e *colly.HTMLElement) {
barSell = e.ChildText("tr:nth-child(2) > td:nth-child(2)")
barBuy = e.ChildText("tr:nth-child(2) > td:nth-child(3)")
ornamentSell = e.ChildText("tr:nth-child(3) > td:nth-child(2)")
ornamentBuy = e.ChildText("tr:nth-child(3) > td:nth-child(3)")
statusChange = e.ChildAttr("tr:nth-child(4) > td.span > .imgp", "alt")
todayChange = strings.Split(e.ChildText("tr:nth-child(4) > td:nth-child(1)"), " ")[1]
@buildingwatsize
buildingwatsize / Dockerfile
Created July 16, 2020 07:31
Goldnoti - Dockerfile
FROM golang:1.14-alpine AS build
COPY ./ /app/
WORKDIR /app/
RUN CGO_ENABLED=0 GOOS=linux go build -o /bin/goldnoti
FROM alpine:3.12
RUN apk add --no-cache tzdata
COPY --from=build /bin/goldnoti /
COPY ./config /config
ENV ENV=dev
@buildingwatsize
buildingwatsize / docker-compose.yml
Created July 16, 2020 08:57
Goldnoti - docker-compose.yml
version: "3"
services:
goldnoti:
container_name: goldnoti
image: goldnoti:latest
ports:
- 10999:10999
@buildingwatsize
buildingwatsize / heroku.yml
Created July 16, 2020 09:00
Goldnoti - heroku.yml
# Note: we don't have `run` section because Heroku uses the `CMD` specified in the `Dockerfile` instead
build:
docker:
web: Dockerfile
config:
ENV: dev
@buildingwatsize
buildingwatsize / api.go
Created July 20, 2020 09:13
api.go - Goldnoti [Phase 2]
// GetTodayPriceForLINEBot : Get today gold price with webhook
func GetTodayPriceForLINEBot(w http.ResponseWriter, r *http.Request) {
log.Println("------- API: GetTodayPriceForLINEBot -------")
defer r.Body.Close()
w.Header().Set(contentTypeKey, contentTypeValue)
if !isPOST(r) {
ResponseMethodNotAllowed(w)
return
}
@buildingwatsize
buildingwatsize / service.go
Last active July 20, 2020 09:18
service.go - Goldnoti [Phase 2]
// HandleLINEEventMessage : Handle LINE Event Message for LINE Bot Client
func HandleLINEEventMessage(event *linebot.Event) {
switch message := event.Message.(type) {
case *linebot.TextMessage:
textIncoming := message.Text
log.Println("[INFO]: Text Incoming |", textIncoming)
uid := event.Source.UserID
log.Println("[INFO]: User ID |", uid)
profile := repository.Bot.GetProfile(uid)
@buildingwatsize
buildingwatsize / repository.go
Created July 20, 2020 09:21
repository.go - Goldnoti [Phase 2]
var (
// Bot : For LINE Bot Client Configuration
Bot *linebot.Client
channelSecret string
channelToken string
)
// SetupLINEConfig : Setup Channel Secret and Channel Token for using in LINE Bot
func SetupLINEConfig() {
channelSecret = os.Getenv("CHANNEL_SECRET")