Skip to content

Instantly share code, notes, and snippets.

View benyanke's full-sized avatar

Ben Yanke benyanke

View GitHub Profile
@ageis
ageis / .bashrc 02-25-2020
Last active May 10, 2024 02:34
@ageis's ~/.bashrc 🖥️ with numerous useful functions, aliases and one-liners. ⚠️ NOTE: many paths in sourced scripts and environment variables are specific to my system, but if you dig in I hope you'll find something you can use!
#!/bin/bash
# ~/.bashrc: executed by bash(1) for non-login shells.
# kevin gallagher (@ageis) <[email protected]>
# normally I divide this into separate files: .bashrc, .bash_profile, .bash_aliases and .bash_functions (also .bash_logout), but it's all concatenated here.
ulimit -s unlimited
export MYUID=$(id -u)
export USER="$(id -un)"
if [[ "$TILIX_ID" ]] || [[ "$VTE_VERSION" ]]; then
@dylanmckay
dylanmckay / facebook-contact-info-summary.rb
Last active November 14, 2024 18:04
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@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()
@jessfraz
jessfraz / boxstarter.ps1
Last active October 8, 2024 17:58
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <[email protected]>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@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

@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
@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
@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;
@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'};