Skip to content

Instantly share code, notes, and snippets.

View alexejk's full-sized avatar
:octocat:

Alexej Kubarev alexejk

:octocat:
View GitHub Profile
@alexejk
alexejk / git-prune-branches
Created December 4, 2019 11:26
Simple script to prune local branches
#!/bin/sh
# This script removes any local branch that isn't associated with remote branch.
# As part of the run, it will cleanup any stale references to remote branches (remove tracking for branches that are deleted on remote).
# Script is provided AS IS and can cause loss of work if you do not understand what it does.
echo "This will delete any *local* branch that is not available on remote!"
echo "Abort if you have any local branch not yet pushed to remote that you want to keep."
read -p "Continue? (Y/n)" -n 1 -r input
echo # Move to new line
@alexejk
alexejk / lxc-update-vm.sh
Last active May 1, 2018 08:27
LXD: Management notes
#!/bin/bash
# Purpose: Update all lxd vms
# -------------------------------------------------------
# Get the vm list
vms="$(lxc list volatile.last_state.power=RUNNING -c n --format csv)"
# Update each vm
update_vm(){
local vm="$1"

Keybase proof

I hereby claim:

  • I am alexejk on github.
  • I am alexejk (https://keybase.io/alexejk) on keybase.
  • I have a public key whose fingerprint is 438D 1406 F78A 8114 AD6D B93B EB7F F167 F615 F3BB

To claim this, I am signing this object:

@alexejk
alexejk / jvm-download.md
Last active July 6, 2017 08:36
Oracle JVM download with Curl/Wget

How-to: Oracle JVM download

You need to get the correct URL from Oracle.com Each new release changes a hash and just substitution of links won't work.

Using wget

Usage: wget --no-cookies --header "Cookie: oraclelicense=a" <URL>

For example:
wget --no-cookies --header "Cookie: oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm

#List installed Java versions
function jls() {
/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d" | cut -d , -f 1 | colrm 1 4 | grep -v Home
}
#Change active java version
function jset() {
local isLink=false
if ! [ "x$JAVA_HOME" = "x" ]; then
if [ -h $JAVA_HOME ]; then
@alexejk
alexejk / gradle-wrapper
Created January 16, 2014 14:37
Use Gradle Wrapper when available
function gradle() {
if [[ -x "gradlew" ]]; then
./gradlew "$@"
else
$GRADLE_HOME/bin/gradle "$@"
fi
}
@alexejk
alexejk / tomcat.sh
Created November 8, 2012 11:48 — forked from valotas/tomcat.sh
Tomcat init.d script
#!/bin/bash
#
# tomcat7 This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat7
# Required-Start: $network $syslog
# Required-Stop: $network $syslog