Skip to content

Instantly share code, notes, and snippets.

View mAster-rAdio's full-sized avatar

Master Radio mAster-rAdio

View GitHub Profile
#!/usr/bin/perl
use strict;
use warnings;
# sets mtime and atime of files to the latest commit time in git
#
# This is useful for serving static content (managed by git)
# from a cluster of identically configured HTTP servers. HTTP
# clients and content delivery networks can get consistent
# Last-Modified headers no matter which HTTP server in the
@voluntas
voluntas / loadtest.rst
Last active April 3, 2024 03:25
負荷試験コトハジメ
@mAster-rAdio
mAster-rAdio / terraform_file-target.md
Created April 3, 2019 05:25
Terraformでファイル単位でtarget指定するためのワンライナー

Terraformでファイル単位でtarget指定するためのワンライナー

plan

terraform plan `cat hoge.tf | terraform fmt - | grep -E 'resource |module ' | tr -d '"' | awk '{printf("-target=%s.%s ",$2,$3);}'`

apply

@pacohope
pacohope / FreeBSD-11-ec2-cloudwatch.md
Last active November 24, 2023 00:04
FreeBSD 11 on AWS EC2, with CloudWatch Logs and EC2 Metrics

Introduction

This is how you would create a livable FreeBSD instance on EC2 by hand. The smart thing to do is to automate most of these actions. But I do it this way so you can see and understand all the different techniques. I want to create FreeBSD instances in EC2 and I want some of the management benefits that come from native AWS technologies like CloudWatch. It can be done, but it takes a bit of extra work because FreeBSD isn't Linux, and AWS doesn't directly support FreeBSD.

Prepping in AWS land

Before we go far, we will want some things setup in AWS IAM and VPC. I assume you have already created a VPC, decided what network numbers you're going to use, created a subnet and so on. If you haven't done those basic things, you need to go do them. I also assume you've created an ssh key and uploaded it to your AWS account.

@quiver
quiver / athena.py
Last active August 19, 2022 11:19
query SQL to Amazon Athena and save its results from Amazon S3 Raw
#!/usr/bin/env python
# vim: set fileencoding=utf8 :
```
$ pip install -U boto3 retrying
$ export AWS_DEFAULT_PROFILE=test
$ cat foo.sql
select count(*)
from bar
$ python athena.py foo.sql
$ ls -1
@jwhulette
jwhulette / awslogs-agent-setup.py
Last active February 20, 2024 17:03
[FreeBSD AWS CloudWatch Logs installer] #python #aws
#!/usr/bin/python
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of the License is
# located at http://aws.amazon.com/asl/ or in the "license" file accompanying
# this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
@antimius
antimius / find_latest_ami.sh
Last active March 19, 2018 05:04
Script to find and print the latest stable, HVM, EBS GP2 backed EC2 AMIs from major OS vendors. Requires aws-cli to be installed. Takes a long time to complete due to AWS describe-images call being slow.
#!/bin/bash
# prints latest, stable, HVM, EBS GP2 backed AMIs for major OSs
# amazon, redhat 309956199498, ubuntu 099720109477, freebsd 118940168514, CentOS marketplace code
REDHAT=309956199498
UBUNTU=099720109477
FREEBSD=118940168514
MICROSOFT=801119661308
REGION=${REGION:-"us-east-1"}
@en129
en129 / getLastPush.sh
Created January 3, 2017 05:01
pushbulletからチャットテキスト受信
#! /bin/sh
getIden=$(echo $("$PROGDIR"../pushbullet-bash/pushbullet pushes recent) | grep -o -E '([A-Za-z0-9]{22})')
#iden表示
#echo $getIden
if [ -z $getIden ]; then
#testコマンドオプション-z:文字列長が0ならば真
echo "not pushes receved"
else
@netmarkjp
netmarkjp / systemctl_edit_oneliner.sh
Created December 13, 2016 22:06
oneliner: edit systemd config with systemctl
EDITOR=tee sudo -E bash -c '( echo "[Service]" ; echo "ExecStart=" ; echo "ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375" ) | systemctl edit docker.service'
@YukiYamashina
YukiYamashina / README.md
Last active October 21, 2020 08:45
QdmailをPHP7.0に対応させる

QdmailをPHP7.0に対応させる

  • コンストラクタ名を__constructorに修正
  • newの前の&を削除
  • QdmailComponent内のfunction & smtpObjectの引数をスーパークラスと合わせて$null = falseに修正
  • HTMLメールでのマルチパート順序をhtml, plain, OMITからplain, html, OMITへ変更
  • iPhone用アドレスをi.softbank.ne.jpからi.softbank.jpに修正