Skip to content

Instantly share code, notes, and snippets.

@asmega
asmega / main.sh
Last active July 29, 2019 11:00
brew
brew info node
# switch version
brew switch icu4c 63.1
# adjust brightness in smaller increments
Shift (⇧) + Option (alt) + Brightness
@asmega
asmega / run.sh
Created July 12, 2019 04:59
image manipulation
# correctly orientate images
mogrify -auto-orient *.jpg
for i in {1..1000} ; do
echo "thing"
sleep 3
done
diskutil list
# diskutil unmountDisk /dev/diskN
diskutil unmountDisk /dev/disk3
sudo dd bs=1m if=2017-06-21-raspbian-jessie.img of=/dev/rdiskN
convert input.png -resize 50% output.png
@asmega
asmega / gist:cf7b189e3f556166d9beec028eb5feb8
Created September 24, 2018 16:58
google chrome disable sync
defaults write com.google.Chrome SyncDisabled -bool true
defaults write com.google.Chrome RestrictSigninToPattern -string ".*@example.com"
@asmega
asmega / gist:297af8ab4dabfa5438649d65b82ee618
Created August 18, 2017 15:43
nginx log - count unique ips
cat nginx.access.log | cut -d ' ' -f3 | sort | uniq -c | sort -r -g | head -n10
@asmega
asmega / group_by_col.rb
Created July 18, 2017 16:54
group into columns
max = 10.to_f
cols = 3
target = (max/cols).ceil
(0..max).to_a.slice_before(target: target) do |i,state|
if i > state[:target]
state[:target] += state[:target]
true
else
false
@asmega
asmega / wrap
Created June 29, 2017 10:15
wrapper
#!/usr/bin/env ruby
require 'pty'
@script = "./rand.rb"
@interval = 5
def start
puts 'starting'