Skip to content

Instantly share code, notes, and snippets.

@plasticut
plasticut / make_git_bundle.sh
Created November 11, 2021 08:32
Make git repository bundle
#!/bin/bash
REPO_SSH_URL=$1
if [ "$REPO_SSH_URL" == "" ];
then
echo "Enter ssh git repo url"
exit 1;
fi
@plasticut
plasticut / .bash_profile
Created August 16, 2018 08:45
Add git branch to bash prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\$(parse_git_branch)\[\033[00m\] $ "
@plasticut
plasticut / backup_database.sh
Last active December 20, 2017 07:36
Backup dokku database
#!/bin/bash
APP_NAME=<APP NAME>
HOST=<FTP HOST>
USER=<FTP USER>
PASS=<FTP PASSWORD>
# mongo, mysql, postgres & etc.
DB=mongo
CUR_DATE=$(date +%F-%H-%M)
BACKUP_COUNT=30

Keybase proof

I hereby claim:

  • I am plasticut on github.
  • I am plasticut (https://keybase.io/plasticut) on keybase.
  • I have a public key ASAtkBcYQNTNBoPyNbHfp-7YqDTSbo5qkvbhSLtZu7-3vgo

To claim this, I am signing this object:

@plasticut
plasticut / youtrack-install
Created July 25, 2017 08:47
ubuntu youtrack installation
apt-get update
apt-get install openjdk-8-jdk
mkdir /opt/youtrack
useradd youtrack -r -d /opt/youtrack/ -s /bin/bash
cat <<EOT >> /etc/init.d/youtrack
#! /bin/sh
### BEGIN INIT INFO
# Provides: youtrack
# Required-Start: $local_fs $remote_fs
@plasticut
plasticut / makegif.sh
Created December 17, 2016 14:34
Make gif from sequence using imagemagick
#!/bin/bash
rm -rf ./resize
mkdir ./resize
mogrify -resize 512 -quality 100 -path ./resize *.jpg
cd ./resize
convert -bordercolor white -border 0 -layers OptimizePlus -delay 1x30 *.jpg -loop 0 a.gif
@plasticut
plasticut / mount_virtualbox_image.sh
Created May 17, 2016 07:17
Mount VirtualBox VDI image
sudo apt-get install qemu-kvm
# load kernel module
sudo modprobe nbd
# make virtual drive device
sudo qemu-nbd -c /dev/nbd0 /home/user/sdb.vdi
# show disk info
#sudo fdisk -l /dev/nbd0
@plasticut
plasticut / convert_html_to_jade.sh
Created November 13, 2015 10:28
Convert html to jade.
sudo npm install -g html2jade
find . -name "*.html" -exec sh -c 'html2jade --donotencode --bodyless --noemptypipe "$1"' sh {} \;
@plasticut
plasticut / inc-watch.sh
Created July 4, 2015 06:35
fix: watch ENOSPC
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@plasticut
plasticut / access_rights.sh
Created April 14, 2015 10:19
Set recursive file access rights
# read & exec perm for dirs
find ./ -type d -print0 | xargs -0 chmod 755
# read perm for files
find ./ -type f -print0 | xargs -0 chmod 644