Skip to content

Instantly share code, notes, and snippets.

//Define variable before init ActionHero SpecHelper
api.config.upload_config.storage_path = 'c:\\tmp'
// Run API
let {fileUpLoad} = await api.specHelper.runAction('SuperFileUpload')
// Run Async/Awaith Test API
await chai.request('http://localhost:' + api.config.servers.web.port)
// API end point
/* res.body return JSON object from an API
* define object or key-value you want to check ( property and value )
@udomsak
udomsak / docker-compose.yml
Created October 11, 2018 03:39
verdaccio docker-compose
version: "2"
services:
verdaccio:
image: verdaccio/verdaccio
hostname: npm-registry
ports:
- 4873:4873
# volumes:
# - /etc/verdaccio/conf:/verdaccio/conf
# - /var/cache/verdaccio/storage:/verdaccio/storage
@udomsak
udomsak / linearRegression.ipynb
Last active October 21, 2018 05:43
บันทึก ไฟล์ examsample LinearRegression ระหว่างสอน วันที่ 20-10-2018
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@udomsak
udomsak / message-with-pic.json
Last active October 24, 2018 09:48
Navy Line messaging payload format
{
"events": [
{
"type": "message",
"replyToken": "e772d6f6b3ce4f198f58a0671889ac55",
"source": {
"userId": "U55aa364949999f07b2f7b6b9de0ef07",
"type": "user"
},
"timestamp": 1540374281107,
@udomsak
udomsak / kyoto-tycoon.fedora.29.sh
Created December 19, 2018 17:13
kyoto-tycoon compile on fedora-core 29
git clone [email protected]:cloudflare/kyototycoon.git
sudo dnf install openssl-devel kyotocabinet-devel
./configure 
make 
sudo make install 
echo /usr/local/lib > /etc/ld.so.conf.d/kyoto-tycoon.conf
sudo ldconfig
@udomsak
udomsak / Dockerfile
Created December 19, 2018 17:35
Dockerfile kyoto-tycoon ( kt-server ) by @narate
FROM alpine:3.7
MAINTAINER Narate Ketram <[email protected]>
RUN apk update && apk add git build-base lua5.1-dev lzo-dev zlib-dev
RUN cd /tmp && \
git clone https://github.com/narate/kyoto.git && \
cd kyoto && \
make && \
make install && \
make clean && \
@udomsak
udomsak / command.sh
Created December 20, 2018 07:43
kubectl apply rbac rules to microk8s
# Restart API server
systemctl restart snap.microk8s.daemon-apiserverd
# Apply rules
kubectl apply -f rbac-microk8s.yml
# Check running
kubectl get clusterroles cluster-admin
@udomsak
udomsak / postman_fc29_install.sh
Created December 24, 2018 17:00
Install postman on Fedora core 29 - Dec 2018
#!/bin/bash
wget https://dl.pstmn.io/download/latest/linux64 -O postman-linux-x64.tar.gz
sudo tar xvzf postman-linux-x64.tar.gz -C /opt
sudo ln -s /opt/Postman/Postman /usr/bin/postman
cat << EOF > ~/.local/share/applications/postman2.desktop
[Desktop Entry]
Name=Postman
GenericName=API Client
@udomsak
udomsak / runner.js
Created December 25, 2018 14:11
fastify-validation not work.
// Require the framework and instantiate it
const fastify = require('fastify')({
logger: true
})
const post_schema = {
method: 'GET',
schema: {
body: {
type: 'object',
@udomsak
udomsak / bulk_remove_fork.py
Last active April 11, 2019 07:35
Bulk remove folks repositories
#!/usr/bin/env python
from github import Github
#https://github.com/settings/tokens
g = Github("4a3d3c5ba12e402015dcdcf55c312e0614xxxxx888s")
folks_repo = [ repo for repo in g.get_user().get_repos() if repo.fork == True]
for repo in folks_repo:
repo.delete()