Skip to content

Instantly share code, notes, and snippets.

docker

Delete all containers

docker rm container $(docker ps -a -q)

Delete all images

convert input.png -resize 50% output.png
# list indexes
curl -X GET "localhost:9200/_aliases"
# remove readonly
curl -X PUT "localhost:9200/recipes/_settings" -H 'Content-Type: application/json' -d'
{
"index": {
"blocks.read_only": false,
@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"
diskutil list
# diskutil unmountDisk /dev/diskN
diskutil unmountDisk /dev/disk3
sudo dd bs=1m if=2017-06-21-raspbian-jessie.img of=/dev/rdiskN
@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'
@asmega
asmega / index.sh
Last active June 8, 2017 16:28
install imagemagick woes
$ brew install imagemagick
==> /usr/local/Cellar/imagemagick/6.8.6-3
$ brew install pkgconfig
==> /usr/local/Cellar/pkg-config/0.28
$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.6-3/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.6-3/lib/pkgconfig/ gem install rmagick
Successfully installed rmagick-2.13.2
C_INCLUDE_PATH=/usr/local/Cellar/imagemagick@6/6.9.8-4/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.8-4/lib/pkgconfig/ gem install rmagick -v '2.16.0'
@asmega
asmega / index.sh
Created March 26, 2017 17:33
remove postgres pid file on mac
rm /usr/local/var/postgres/postmaster.pid