Skip to content

Instantly share code, notes, and snippets.

@meyju
meyju / ip_info.sh
Last active February 3, 2016 07:08
Showing all IPv4 and IPv6 adresses on a server
ip -o a|grep -v mtu|cut -d' ' -f2,7
cat ${LOOPDEV}
@meyju
meyju / generate_disk_io.sh
Created November 11, 2015 14:01
Generating Disk IO
touch /file && chattr +S /file && cat /dev/urandom >> /file
@meyju
meyju / find_files_sorted_by_modtime.sh
Created July 28, 2015 12:05
find - sort by modified time
find . -printf "%T@ %Tc %p\n" | sort -n
find /home/ -type f -printf "%T@ %p\n" | sort -n | awk '{print $2}'|xargs ls -l
@meyju
meyju / cli_say.sh
Last active September 8, 2015 15:55
OS X Fun - "I'm watching you" with volume control
VOLUME=$(osascript -e "get output volume of (get volume settings)") && osascript -e "set volume output volume 30" && say -v Whisper "I'm watching you" && osascript -e "set volume output volume $VOLUME" && unset VOLUME
# Set it as a Cronjob every 30 Minutes for example :-)
@meyju
meyju / dnscache.command
Created June 16, 2015 11:14
OS X Launchbar - Clear DNS Cache
# Cleaning DNS Cache
# sudo config : <username> localhost=NOPASSWD:/<path_to_command>/dnscache.command
sudo dscacheutil -flushcache
osascript -e 'tell application "Terminal" to quit' & exit
@meyju
meyju / cloudwatch_logs_download.sh
Created May 5, 2015 09:11
Script downloads all logs from aws cloudwatch logs
#!/usr/bin/env bash
#
# Copyright 2015 Julian Meyer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@meyju
meyju / force-instance-start.sh
Created March 25, 2015 07:55
Force aws instance start
#!/bin/bash
#
# Info: Script trys to start an aws instance, if the region is out of capacity
# Autor: Julian Meyer
# Version: 0.1
#
# USE AT YOUR OWN RISK!
if [ $# -lt 1 ]; then
echo "Usage: $0 [instance-id] [...]"
@meyju
meyju / lifespan-stop
Created January 13, 2015 15:05
cron server stop by lifespan
# FILE: /etc/cron.d/lifespan-stop
# stopping this server after lifespan
# After 5h 50m +5m
@reboot root sleep 350m && /sbin/shutdown -h +5 "Lifespan Halt!"
@meyju
meyju / gist:1ed7bfa0dfdebb51218e
Created December 3, 2014 08:48
Average Apache Process Memory Usage
ps aux | grep apache2 | grep -v pts | awk 'BEGIN {print "PID RSS COMMAND"} { total += $6; procs += 1; print $2,$6,$11 } END { print "TOTAL: ",total,"kb /",procs,"=",total/procs, "kb" }'