Skip to content

Instantly share code, notes, and snippets.

View delfer's full-sized avatar

Alexander Chumakov delfer

View GitHub Profile
@delfer
delfer / README.md
Last active August 29, 2015 14:25 — forked from magnetikonline/README.md
IE 7/8/9/10/11 Virtual machines from Microsoft - Linux w/VirtualBox installation notes.
@delfer
delfer / rewriter-http
Last active May 21, 2017 14:35
Squid for offline
#!/usr/bin/perl
$| = 1;
while (<>) {
s/^http:/https:/; # replace "http" with "https"
print;
}
@delfer
delfer / k8s_restart_controller
Last active July 21, 2017 11:31
Restart Kubernetes controller
docker ps | grep '/hyperkube controlle' | awk '{ print $1 }' | xargs docker stop
@delfer
delfer / docker_cleaner.sh
Created July 21, 2017 17:17
clen docker images, containers and volumes
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi
# remove unused volumes:
find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(
@delfer
delfer / drone_trig
Last active July 27, 2017 11:36
Trigger drone build
git tag build0 && git push origin build0 && sleep 600 && git push origin :build0 && git tag -d build0
#!/bin/sh
if [ $# -eq 0 ]
then
echo usage $0 files ...
exit 1
fi
for file in "$@"
do
@delfer
delfer / detach_cinder_mysql.sql
Created October 9, 2017 12:45
Set a volume as detached in Cinder
-- https://raymii.org/s/articles/Fix_inconsistent_Openstack_volumes_and_instances_from_Cinder_and_Nova_via_the_database.html#Set_a_volume_as_detached_in_Cinder
-- $ mysql cinder_db
update cinder.volumes set attach_status='detached',status='available' where id ='$volume_uuid';
@delfer
delfer / gist:7bcf6d9abd49d524b161ab29fafa7f6b
Created October 18, 2017 07:48
docker-registry-cleaner-in-k8s.sh
#!/bin/bash
#prepare
#apk update --no-cache && apk add bash curl
REGISTRY_URL=http://USER:[email protected]$REGISTRY_HTTP_ADDR
REGISTRY_DIR=$REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY
REPO_DIR=${REGISTRY_DIR}/docker/registry/v2/repositories
@delfer
delfer / compare.sh
Last active November 2, 2017 09:29
Compare XML
#/bin/bash
echo > result
for i in QU_*.xml.xsd
do
for j in QU_*.xml.xsd
do
DIFF=$(comm -12 --nocheck-order $i $j | wc -l)
echo $DIFF $i $j >> result
@delfer
delfer / oh-my-zsh-rc-plugins
Created November 3, 2017 15:19
oh-my-zsh-rc-plugins
plugins=(ant branch colored-man-pages colorize command-not-found common-aliases compleat docker-compose docker git go gradle heroku history-substring-
search kubectl man mvn nmap node npm pip postgres python redis-cli rsync screen spring ssh-agent sudo systemd ubuntu wakeonlan)