This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Remove logs older than 7 days ago | |
| log_file="$1" | |
| days=7 | |
| old_log_count=$(cat "$log_file" | cut -d ' ' -f 1,2,3 | awk '{print "date -d \"" $0 "\" +%s"}' | sh | awk -v days=$days -v date=$(date +%s) '{if ($1 < date - 86400 * days) print $0}' | wc -l) | |
| [ $old_log_count -gt 0 ] && sed -i "1,${old_log_count}d" "$log_file" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/zsh | |
| LC_CTYPE="en_US.UTF-8" | |
| file=/Users/lliu/dev/icons/Automation/auto.png | |
| printf "\u263C" | convert -size 1024x1024 -background green -fill white -pointsize 800 \ | |
| -gravity center label:@- $file | |
| open $file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # https://gist.github.com/Lerg/b0a643a13f751747976f | |
| base=$1 | |
| if [ -z $base ] | |
| then | |
| echo No argument given | |
| else | |
| ## | |
| ## iOS files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/awk BEGIN{a=ARGV[1];sub("[A-z_.]+$","Carthage/Build/Mac",a);system("/usr/bin/env\tswift\t-F\t"a"\t"ARGV[1])} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| retry_count=3 | |
| task() { | |
| echo $i | |
| [ $1 -ge 2 ] | |
| } | |
| for i in $(seq 1 $retry_count) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "" | |
| echo "`date`: RUNNING: brew update" | |
| /usr/local/bin/brew update | |
| echo "`date`: FINISHED: brew update" | |
| echo "" |