Skip to content

Instantly share code, notes, and snippets.

View benyanke's full-sized avatar

Ben Yanke benyanke

View GitHub Profile
@pahud
pahud / delete_all_awslogs.sh.md
Last active October 18, 2023 09:13
delete all aws log groups

specify the region

export AWS_DEFAULT_REGION=ap-northeast-1
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table | \
awk '{print $2}' | grep -v ^$ | while read x; do  echo "deleting $x" ; aws logs delete-log-group --log-group-name $x; done

only delete loggroup name starting with /aws/lambda

@madx
madx / .gitconfig
Last active August 3, 2022 10:09
Git aliases for a simple tag based Heroku deploy strategy
[alias]
deploy = ! git checkout master && git tag-deploy && git push && git push --tags && git push production master
deploy-staging = ! git checkout develop && git tag-deploy staging && git push && git push --tags && git push staging develop:master
tag-deploy = ! sh -c 'git tag "${0:-production}-`date +%Y%m%d%H%M%S`-$USER"'
@dlinsley
dlinsley / change_storage_class.py
Last active June 27, 2022 06:25
aws s3 bucket change storage class by object size
import boto3
import argparse
import string
parser = argparse.ArgumentParser('Change storage class of s3 objects')
parser.add_argument('--bucket', dest='myBucket', default='yourBucketName', help='S3 Bucket to search')
parser.add_argument('--from', dest='fromPath', default='', help='s3 path to start search from')
cliArgs = parser.parse_args()
@vgeshel
vgeshel / function.js
Last active February 9, 2022 09:19
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/...';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
@enryold
enryold / storage-efs-mountfilesystem.config
Created January 16, 2017 16:27
EFS mount file system script for Elastic Beanstalk .ebconfig
#
# Replace FILESYSTEM-ID-HERE and REGION-ID-HERE
#
option_settings:
- option_name: EFS_VOLUME_ID
value: FILESYSTEM-ID-HERE
- option_name: EFS_REGION
value: REGION-ID-HERE
@greg76
greg76 / pocketmine.sh
Last active March 26, 2020 10:54
simple shell script to run pocketmine as a service/daemon
#!/bin/sh
### BEGIN INIT INFO
# Provides: pocketmine
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@brasey
brasey / Masterless Puppet using a Puppetfile.md
Created November 18, 2014 20:58
Masterless Puppet using a Puppetfile

Masterless Puppet using a Puppetfile

The problem

When running Puppet in masterless mode, meaning there is no Puppet Master for the node to connect to, one of the problems you have to solve is how to get all your Puppet modules onto the node. Without going into all the possible ways of doing this, one nice and clean way to solve the problem is to use a Puppetfile.

If you know what a Ruby gemfile is, you can guess what a Puppetfile is. If you don't, think of a very simple list declaring the modules that a node should get, including ways to get those modules. Like this:

forge 'forge.puppetlabs.com'
@rupl
rupl / drupal-test.js
Last active November 18, 2017 23:24
This sample accompanies a blog post series about CasperJS found at http://fourword.fourkitchens.com/article/testing-drupal-casperjs
/**
* @file
* Testing a demo of Drupal. The script will log in and check for various
* features in Drupal core. This demo was inspired by a similar script for
* a Wordpress site. The original script was written by Henrique Vicente.
*
* @see https://github.com/henvic/phantom-casper-simple-talk/blob/master/wordpress.js
*/
// Set up variables to visit a URL and log in.
@hrchu
hrchu / start-chrome.sh
Created January 26, 2016 08:38
start google chrome in a new session, and import profile from origin
#!/bin/bash
# remove ':' from screen id
PROFILE="session${DISPLAY#:}"
PROFILE_DIRECTORY="$HOME/.google-chrome/$PROFILE"
mkdir -p $PROFILE_DIRECTORY
# import profile (includes bookmark) from origin
if [ ! -d "$PROFILE_PATH/Default" ]; then
cp -r $HOME/.config/google-chrome/Default $PROFILE_DIRECTORY/Default;
@anthumchris
anthumchris / post-receive
Last active March 29, 2017 18:25
Git Push to Deploy — Instantly deploy your local Git repository to your remote web server
#/bin/bash
# This script will push your local repository's latest commit to a remote repository on your server.
# It's useful for quickly pushing your local changes to deployment servers (Dev, Stage, Prod/Live, etc.)
#
# This file should be placed in your remote server's project's git hooks folder and named .git/hooks/post-receive.
# Security reminder: Your web server should not allow access to the /.git folder URL
#
# Ensure that this script is executable:
# $ chmod +x .git/hooks/post-receive