Skip to content

Instantly share code, notes, and snippets.

View sonuame's full-sized avatar
😀
Life z good

Sunil sonuame

😀
Life z good
View GitHub Profile
@sonuame
sonuame / webmin-centos.sh
Created October 13, 2020 20:10
centos - webmin
#nano sudo vi /etc/yum.repos.d/webmin.repo
echo "[Webmin]" >> /etc/yum.repos.d/webmin.repo
echo "name=Webmin Distribution Neutral" >> /etc/yum.repos.d/webmin.repo
echo "#baseurl=http://download.webmin.com/download/yum" >> /etc/yum.repos.d/webmin.repo
echo "mirrorlist=http://download.webmin.com/download/yum/mirrorlist" >> /etc/yum.repos.d/webmin.repo
echo "enabled=1" >> /etc/yum.repos.d/webmin.repo
echo "" >> /etc/yum.repos.d/webmin.repo
@sonuame
sonuame / rabbitmq-setup-deb.sh
Last active October 30, 2021 20:52
RabbitMQ setup
#!/bin/sh
## If sudo is not available on the system,
## uncomment the line below to install it
# apt-get install -y sudo
sudo apt-get update -y
## Install prerequisites
sudo apt-get install curl gnupg -y
@sonuame
sonuame / graylog-docker.sh
Last active March 6, 2021 08:12
graylog-docker.sh
sudo docker stop graylog
sudo docker rm graylog
sudo docker run --name graylog --link mongo --link elasticsearch -p 9100:9000 -p 12201:12201 -p 1514:1514 -e GRAYLOG_HTTP_EXTERNAL_URI="http://core.tripsaathi.com:9100/" -d graylog/graylog:4.0
@sonuame
sonuame / clean.sh
Last active November 16, 2021 03:24
Ubuntu Cleanup
#!/bin/sh -eux
# Delete all Linux headers
dpkg --list \
| awk '{ print $2 }' \
| grep 'linux-headers' \
| xargs apt-get -y purge;
# Remove specific Linux kernels, such as linux-image-3.11.0-15-generic but
# keeps the current kernel and does not touch the virtual packages,
# e.g. 'linux-image-generic', etc.
dpkg --list \
@sonuame
sonuame / expand-rootfs.sh
Created July 13, 2021 03:40
Raspi-Issues
#!/bin/bash
#copied from https://raw.githubusercontent.com/Snoop05/raspberrypi/master/expand-rootfs.sh
VERSION="0.1"
if (($EUID < 1)); then
export ROOTDEV=$(mount | grep ' / '|cut -d' ' -f 1)
export ROOTPART=$(lsblk -no NAME $ROOTDEV)
export ROOTDISK=$(lsblk -no PKNAME $ROOTDEV)
export ROOTPARTNUM=$(cat /sys/class/block/$ROOTPART/partition)
@sonuame
sonuame / docker-install.sh
Last active July 14, 2021 19:25
Docker and Kube Setup
sudo apt update
sudo apt install -y docker.io
sudo systemctl enable docker --now
sudo docker info
sudo usermod -aG docker $USER
newgrp docker
# docker-ce - raspberry-64
@sonuame
sonuame / pstoricohddst-gdi
Last active November 13, 2021 22:45
Ricoh-SP111 RaspberryPi Setup
#!/bin/bash
# Debug mode: change to 'yes' to enable
DEBUG=no
function log() {
[ "${DEBUG}" = "yes" ] && echo $* | logger -t "$0[$$]"
}
function logpipe() {
[Unit]
Description=ATS Backend APIs
StartLimitIntervalSec=0
[Service]
Environment=PORT=5555
Environment=LOG=true
ExecStart=node dist/main
WorkingDirectory=/var/local/ats-core
User=root
@sonuame
sonuame / Acquire-Token.cs
Created April 6, 2022 19:13
Azure Active Directory
public static void GetAuthorizationToken()
{
ClientCredential cc = new ClientCredential(AzureDetails.ClientID, AzureDetails.ClientSecret);
var context = new AuthenticationContext("https://login.microsoftonline.com/" + AzureDetails.TenantID);
var result = context.AcquireTokenAsync("https://management.azure.com/", cc);
if (result == null)
{
throw new InvalidOperationException("Failed to obtain the Access token");
}
AzureDetails.AccessToken = result.Result.AccessToken;
@sonuame
sonuame / certbot.sh
Created July 27, 2022 07:30
Nginx DNS Challenge
sudo apt-add-repository ppa:certbot/certbot
sudo apt install certbot
wget https://github.com/joohoi/acme-dns-certbot-joohoi/raw/master/acme-dns-auth.py
chmod +x acme-dns-auth.py
nano acme-dns-auth.py
# change #!/usr/bin/env python to #!/usr/bin/env python3
sudo mv acme-dns-auth.py /etc/letsencrypt/