Skip to content

Instantly share code, notes, and snippets.

View shyamjos's full-sized avatar
:octocat:
&> /dev/null

Shyam Jos shyamjos

:octocat:
&> /dev/null
View GitHub Profile
@shyamjos
shyamjos / git2svn.txt
Created May 12, 2019 17:47
How to push a git repo to svn
#Install svn and git-svn packages in your local machine
sudo apt get install subversion git-svn
create a SVN repo for the git project you want to push
svn mkdir --parents --username myusername http://192.168.60.222:8181/svn/my_projects/my_git_app/trunk -m "new svn repo for git code"
#Initialize svn repo with git url
git svn init http://192.168.60.222:8181/svn/my_projects/my_git_app -s
@shyamjos
shyamjos / lftp_upload.sh
Created May 12, 2019 17:15
lftp bulk file upload script
#!/bin/bash
#lftp upload Script shyam jos 2017
# turn off history substitution to allow special chars in password
set +H
LFTPDUSER="company_user"
LFTPDPASSWORD="4Po0ebL!@q5E"
#insert date for loging
@shyamjos
shyamjos / tcpdump.service
Created May 11, 2019 14:02
Systemd unit file for tcpdump with date filename
[Unit]
Description="Systemd script for tcpdump"
After=network.target network-online.target
Wants=network-online.target
[Service]
User=root
ExecStart=/bin/bash -lc 'usr/sbin/tcpdump -i eth0 -C 10000 -G 86400 -w /var/log/tcpdumps/tcp_dump_$$(date +%%Y-%%m-%%d-%%H:%%M:%%S).pcap -z gzip -s 0'
SuccessExitStatus=143
Restart=on-failure
@shyamjos
shyamjos / check_reboot.sh
Created May 11, 2019 13:57
Icinga2 plugin to check if server rebooted
#!/bin/bash
# shyam jos
# Icinga plugin to check if server was rebooted less than 30 minutes ago
read -d. uptime < /proc/uptime
days=$(( uptime/60/60/24 ))
if (( uptime > 1800 ))
then
echo -n "OK! UP $days days | uptime_days=$days"
@shyamjos
shyamjos / generate_ssh_config.sh
Created December 2, 2018 15:14
Generate SSH config from csv or text file in comma separated format
#!/bin/sh
#Sample input file (hosts.csv)
#server-new,172.16.158.35,22,deploy
#server-db,172.16.158.40,2211,deploy
#server-db-old,172.16.158.30,22,admin
#server-db-2,172.16.158.32,1111,user
cat hosts.csv | while read line
do
@shyamjos
shyamjos / arduino_lcd_pin_layout.txt
Last active February 13, 2018 10:51
Pin layout for connecting 16x2 LCD with arduino uno
LCD_PIN1=Arduino_PIN GND
LCD_PIN2=Arduino_PIN 5v
LCD_PIN3=Arduino_PIN GND + add resistors for
LCD_PIN4=Arduino_PIN 2
LCD_PIN5=Arduino_PIN GND
LCD_PIN6=Arduino_PIN 3
LCD_PIN11=Arduino_PIN 4
LCD_PIN12=Arduino_PIN 5
LCD_PIN13=Arduino_PIN 6
LCD_PIN14=Arduino_PIN 7
@shyamjos
shyamjos / mysql-docker.sh
Created April 11, 2017 08:07 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@shyamjos
shyamjos / kodi
Last active November 7, 2019 15:24
kodi upstart script , Start kodi automatically with raspbian boot. Tutorial https://linuxsuperuser.com/install-latest-version-kodi-raspbian-jessie/
#! /bin/sh
### BEGIN INIT INFO
# Provides: kodi
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: XBMC media centre
# Description: Starts the XBMC media centre in standalone mode
### END INIT INFO
@shyamjos
shyamjos / iptables_rules.sh
Created December 5, 2016 03:08 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@shyamjos
shyamjos / mkv2mp3.sh
Created July 13, 2016 06:06
Shell script to convert all .mkv video files in a directory to .mp3
find . -type f -name "*.mkv" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -b:a 320000 -y "${FILE%.mkv}.mp3";' _ '{}' \;