Skip to content

Instantly share code, notes, and snippets.

@j3tm0t0
j3tm0t0 / invoke.js
Last active August 29, 2015 14:10
locally test lambda script
var fs = require('fs');
if(process.argv.length == 3)
{
if(process.argv[2].match(/\.json$/))
{
try{
var event = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
} catch(e) {
console.log("could not parse JSON from file: "+process.argv[2]);
# 1.0.2
vyos@vyos:~$ cat /opt/vyatta/etc/version
Version: VyOS 1.0.2
Description: VyOS 1.0.2 (hydrogen)
Copyright: 2014 SO3 Group
vyos@vyos:~$ configure
[edit]
vyos@vyos# set interfaces openvpn vtun0 local-address '169.254.1.1'
[edit]
@j3tm0t0
j3tm0t0 / eb_complete
Last active August 29, 2015 14:04
bash completion for eb command.
_eb()
{
COMPREPLY=($( compgen -W "init branch start status update stop delete logs events push" ${COMP_WORDS[COMP_CWORD]} ))
}
complete -F _eb eb
// ==UserScript==
// @name AWS MC FreeBSD icon
// @namespace j3tm0t0.gmail.com
// @version 0.1
// @match https://console.aws.amazon.com/ec2/v2/home?*
// ==/UserScript==
var icon = 'data:image/x-icon;base64,'+
'AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAA'+
'AEAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAADwMCACMDAQAk'+
@j3tm0t0
j3tm0t0 / csfn
Last active August 29, 2015 14:03
CoffeeScript + CloudFormation = CoffeeScriptFormation -> csfn
#!/bin/sh
type coffee &> /dev/null || (echo ERROR: CoffeeScript is not installed. > /dev/stderr ; exit -1 )
if [ "$1" = "" ]
then
echo "usage: `basename $0` hoge.coffee [ puge.coffee ... ] > hogepuge.template"
echo ' or aws cloudformation create-stack --stack-name STACKNAME --template-body "$(csfn hoge.coffee)"'
exit 0
fi
$ cat bucket.coffee
Resources =
# You can use comment!
Bucket:
Type:"AWS::S3::Bucket"
Properties:
BucketName: "my-special-bucket"
Template =
AWSTemplateFormatVersion : "2010-09-09"
@j3tm0t0
j3tm0t0 / Dockerfile
Created April 29, 2014 08:41
sample Dockerfile for apache httpd on Amazon Linux on docker on beanstalk
FROM j3tm0t0/amzn
RUN yum -y install httpd
RUN echo hoge > /var/www/html/index.html
CMD ["/usr/sbin/httpd","-D","FOREGROUND"]
EXPOSE 80
@j3tm0t0
j3tm0t0 / log.txt
Created April 11, 2014 08:58
mkdir on S3
~$ aws s3 ls s3://bucket-123/
PRE folder/
~$ aws s3api list-objects --bucket bucket-123
{
"CommonPrefixes": [],
"Contents": [
{
"LastModified": "2014-04-11T08:53:58.000Z",
"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
@j3tm0t0
j3tm0t0 / loadkey.sh
Last active April 18, 2016 09:06
loadkey
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
configure
loadkey vyos http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key
set service ssh disable-password-authentication
commit
@j3tm0t0
j3tm0t0 / VyOS_AMIi_changelog.md
Last active August 29, 2015 13:58
Unofficial VyOS AMI changelog

Unofficial VyOS AMI changelog

1.0.2 rev2

  • auto load config via user-data with following format

config format

system {
  time-zone Asia/Tokyo
}