This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"net" | |
"strings" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: golang:alpine | |
environment: | |
GO111MODULE: "on" | |
steps: | |
- checkout | |
- run: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
readonly CF_ID=<CloudFront ID> | |
readonly CF_PATH="/*" # purging by URL | |
readonly LAMBDA_ARN="<Lambda ARN>" | |
CF_CONFIG=$( aws cloudfront get-distribution-config --id ${CF_ID} | jq '.DistributionConfig' ) | |
CF_ETAG=$( aws cloudfront get-distribution-config --id ${CF_ID} | jq -r '.ETag' ) | |
LAMBDA_VERSION=$( aws lambda list-versions-by-function --function-name ${LAMBDA_ARN} --region us-east-1 | jq -r '.Versions[-1].Version' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
PANE_MINIMUM=2 | |
usage() { | |
cat <<USAGE | |
Usage: $(basename $0) [-c COL] [-r ROW] [--ssh-option SSH_OPTIONS] HOST [HOST2 ...] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lib | |
import ( | |
"sync" | |
"hoge/model" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/service/s3" | |
"github.com/aws/aws-sdk-go/aws/session" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const aws = require('aws-sdk'); | |
const zlib = require('zlib'); | |
const Promise = require('bluebird'); | |
const waf = new aws.WAF({apiVersion: '2015-08-24'}); | |
const s3 = new aws.S3({apiVersion: '2006-03-01'}); | |
let banIPList = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const path = require('path'); | |
const CWebp = require('cwebp').CWebp; | |
module.exports.encode = (imgBuf) => new Promise((resolve, reject) => { | |
if (!fs.existsSync('/usr/local/bin/cwebp')) { | |
const RESOURCES_DIR = path.join(__dirname, "../bin"); | |
process.env.PATH += `:${RESOURCES_DIR}`; | |
process.env.LD_LIBRARY_PATH += `:${RESOURCES_DIR}`; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const aws = require('aws-sdk'); | |
const zlib = require('zlib'); | |
const Promise = require('bluebird'); | |
const waf = new aws.WAF({apiVersion: '2015-08-24'}); | |
const s3 = new aws.S3({apiVersion: '2006-03-01'}); | |
let banIPList = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Realm = require('realm'); | |
const username = 'test'; | |
const password = 'test'; | |
const URL = ''; | |
const registerUser = () => new Promise((resolve, reject) => { | |
Realm.Sync.User.register(URL, username, password, (err, res) => { | |
if (err) { | |
return reject(err); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
# | |
# This script can sync MySQL schema without `DROP TABLE`. | |
# And If table isn't exists, import tables from source. | |
# | |
# Finally there is a confirmation screen. | |
# | |
# Need these packages: mysql, mysqldump, mysqldiff | |
# GitHub: @rluisr |