Skip to content

Instantly share code, notes, and snippets.

View ravihara's full-sized avatar
👨‍💻
https://gist.github.com/ravihara

Ravishankar Haranath ravihara

👨‍💻
https://gist.github.com/ravihara
View GitHub Profile
@ravihara
ravihara / setup-apt-earthly.sh
Last active September 6, 2022 14:24
Setup apt repository for Earthly on Debian systems
#!/bin/bash
keyring_file="/etc/apt/keyrings/earthly-repo.gpg"
echo -e "Installing dependencies for earthly..."
sudo apt update -qq
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
echo -e "\nConfiguring earthly apt repo..."
curl -fsSL https://pkg.earthly.dev/earthly.pgp | sudo gpg --dearmor -o ${keyring_file}
@ravihara
ravihara / almalinux-8.5-build.conf
Created August 31, 2022 07:41
Script setup to build custom GCC toolchain
archives_dir=$HOME/Temp/pkg
build_base=$HOME/Temp/bld
install_base=/opt/gcckit/6.5.0
gcc_version=6.5.0
binutils_version=2.38
libdwarf_version=0.3.4
annobin_version=10.57
gcc_target_name=alma-linux
gcc_pkg_version="udk-alma8-build"
gcc_build_check=0
@ravihara
ravihara / setup-apt-podman.sh
Last active September 6, 2022 12:41
Script to setup podman repo on Debian based systems
#!/bin/bash
podman_bin=$(which podman)
if [ -n "${podman_bin}" ]; then
echo -e "Podman installation found at $podman_bin. Skipping the setup."
exit 1
fi
## Do all the job in tmp folder
@ravihara
ravihara / add-sysuser.sh
Created November 10, 2017 11:06
Shell script to add a system user
#!/bin/bash -e
# Add a system user in Linux
if [ $UID -ne 0 ]; then
echo "You must be a root / superuser, in order to run this script. $(basename $0) aborted."
exit 1
fi
if [ $# -ne 3 ]; then
echo "Usage: $(basename $0) <user-name> <user-home> <gecos-string>"
@ravihara
ravihara / backup-usrinfo.sh
Created November 10, 2017 10:04
Backup user accounts from a linux system (non-system users)
#!/bin/bash -e
# Backup user accounts from a linux system (non-system users)
UGIDLIMIT=1000
MAXLIMIT=29999
# Create a directory to backup
MIGDIR="/tmp/backuinfo"
mkdir -p $MIGDIR && chmod 750 $MIGDIR
#!/bin/bash -e
# Shell script to convert videos in a folder to mp4 format
export IFS=$(echo -en "\n\b")
VID_LIST_FILE="/tmp/videos.txt"
## List out the videos first
rm -f $VID_LIST_FILE
for a in $(find . -iname "video*" -type d); do
@ravihara
ravihara / jjs-require.js
Created January 13, 2016 13:23
CommonJS require function implementation for Nashorn / Java8
// Based on https://github.com/nodyn/jvm-npm
"use strict";
(function() {
var System = java.lang.System,
File = java.io.File,
FileInputStream = java.io.FileInputStream,
StringBuilder = java.lang.StringBuilder,
BufferedReader = java.io.BufferedReader,
InputStreamReader = java.io.InputStreamReader;
@ravihara
ravihara / libreoffice-deb-inst.sh
Last active December 14, 2015 03:18
A bash script to automate the installation of LibreOffice 4.x.y on Debian Squeeze (Stable). Please note: This will uninstall previous libreoffice related packages, already installed on the system. This script is only for 64bit Debian-Squeeze, and installs en-GB language packages only.
#!/bin/bash -e
TMP_INST_DIR="/tmp/LibreOffice"
mkdir -p $TMP_INST_DIR && pushd $TMP_INST_DIR
# Remove existing libreoffice installations
apt-get remove --purge --yes libreoffice* && sync
# Get 4.x version of libreoffice, if not in TMP_INST_DIR
if [ ! -f "LibreOffice_4.0.0_Linux_x86-64_deb.tar.gz" ]; then