Skip to content

Instantly share code, notes, and snippets.

@udomsak
udomsak / debug_aws_transfer_server.log
Created Sep 21, 2021
trace file from aws_transfer_server
View debug_aws_transfer_server.log
This file has been truncated, but you can view the full file.
2021-09-21T23:35:33.774+0700 [DEBUG] Adding temp file log sink: /tmp/terraform-log371252502
2021-09-21T23:35:33.774+0700 [INFO] Terraform version: 0.15.3
2021-09-21T23:35:33.774+0700 [INFO] Go runtime version: go1.16.2
2021-09-21T23:35:33.774+0700 [INFO] CLI args: []string{"/home/ubuntu/.tfenv/versions/0.15.3/terraform", "plan", "-out=tfplan"}
2021-09-21T23:35:33.774+0700 [TRACE] Stdout is a terminal of width 133
2021-09-21T23:35:33.774+0700 [TRACE] Stderr is a terminal of width 133
2021-09-21T23:35:33.774+0700 [TRACE] Stdin is a terminal
2021-09-21T23:35:33.774+0700 [DEBUG] Attempting to open CLI config file: /home/ubuntu/.terraformrc
2021-09-21T23:35:33.774+0700 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
@udomsak
udomsak / sftp_schema.json
Created Sep 9, 2021
aws transfer family session policy schema
View sftp_schema.json
{
"HomeDirectory": "string",
"HomeDirectoryMappings": [
{
"Entry": "string",
"Target": "string"
}
],
"HomeDirectoryType": "string",
"Policy": "string",
@udomsak
udomsak / loki.service
Created May 6, 2021
loki systemd unit file for ubuntu 18.04
View loki.service
[Unit]
Description=Loki service
After=network.target
[Service]
Type=simple
User=loki
ExecStart=/usr/local/bin/loki --config.file /etc/grafana/loki/loki-local-config.yaml
[Install]
@udomsak
udomsak / cf-aws-ecr-with-iam-group-and-role.yaml
Created Nov 30, 2020
CloudFormation Amazon ECR with useraccount attach with IAM policy and group
View cf-aws-ecr-with-iam-group-and-role.yaml
# This Cloudformation will create User login only for AWS ECR with Push/Pull permission without console login permission.
# Output will produce AcessKey and SecretKey with Username.
# Group named 'GroupAccessECRImages'
AWSTemplateFormatVersion: 2010-09-09
Resources:
accessEcrUser:
Type: AWS::IAM::User
Properties:
@udomsak
udomsak / terraform.debug.log
Created Sep 13, 2020
TF_VAR does not pass environment variable to terraform-digitalocean-provider
View terraform.debug.log
2020/09/13 14:24:05 [INFO] Terraform version: 0.13.2
2020/09/13 14:24:05 [INFO] Go runtime version: go1.14.7
2020/09/13 14:24:05 [INFO] CLI args: []string{"C:\\ProgramData\\chocolatey\\lib\\terraform\\tools\\terraform.exe", "apply", "-state=_test.state", "_test_"}
2020/09/13 14:24:05 [DEBUG] Attempting to open CLI config file: C:\Users\Admin\AppData\Roaming\terraform.rc
2020/09/13 14:24:05 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/09/13 14:24:05 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/09/13 14:24:05 [DEBUG] ignoring non-existing provider search directory C:\Users\Admin\AppData\Roaming\terraform.d\plugins
2020/09/13 14:24:05 [DEBUG] ignoring non-existing provider search directory C:\Users\Admin\AppData\Roaming\HashiCorp\Terraform\plugins
2020/09/13 14:24:05 [INFO] CLI command args: []string{"apply", "-state=_test.state", "_test_"}
2020/09/13 14:24:05 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
@udomsak
udomsak / sample_binance.py
Created Aug 23, 2020
การเชื่อมต่อ กับ binance โดยใช้ WS ( WebSocket ) connect เพื่อการเชื่อมต่อแบบ Realtime
View sample_binance.py
"""
Quest: https://www.facebook.com/groups/admin.py.dev/permalink/1437718479746684/
"""
from binance.client import Client
from binance.websockets import BinanceSocketManager
"""
เวลาทำงานกับ WSS ( Web Socket ให้ทำงานกับ API ตัวนี้ )
https://github.com/binance-exchange/binance-official-api-docs/blob/master/web-socket-streams.md
@udomsak
udomsak / python_thailand.ipynb
Last active Aug 2, 2020
community answer | Python Thailand
View python_thailand.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@udomsak
udomsak / bulk_remove_fork.py
Last active Apr 11, 2019
Bulk remove folks repositories
View bulk_remove_fork.py
#!/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()
@udomsak
udomsak / runner.js
Created Dec 25, 2018
fastify-validation not work.
View runner.js
// Require the framework and instantiate it
const fastify = require('fastify')({
logger: true
})
const post_schema = {
method: 'GET',
schema: {
body: {
type: 'object',
@udomsak
udomsak / postman_fc29_install.sh
Created Dec 24, 2018
Install postman on Fedora core 29 - Dec 2018
View postman_fc29_install.sh
#!/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