Skip to content

Instantly share code, notes, and snippets.

View lvnilesh's full-sized avatar
💭
🏆 Vibranium Status Level

LV Nilesh lvnilesh

💭
🏆 Vibranium Status Level
View GitHub Profile
@lvnilesh
lvnilesh / purgehostkey.zsh
Created June 17, 2021 22:14 — forked from nathanalderson/purgehostkey.zsh
zsh function for deleting the bad host key from the previous ssh command
# delete the bad host key from the previous ssh command
purgehostkey() {
cmd=$history[$((HISTCMD-1))]
lineno=$(eval $cmd 2>&1 | grep -oP 'known_hosts:\K\d+')
known_hosts=~/.ssh/known_hosts
host=$(sed -n "${lineno}p" $known_hosts | cut --delimiter=' ' --fields=1)
sed -i -e "${lineno}d" $known_hosts
echo "Deleted $host from known_hosts:$lineno 🖥️🔑💥"
eval $cmd -o StrictHostKeyChecking=accept-new
}
@lvnilesh
lvnilesh / README.md
Created June 9, 2021 01:06 — forked from mrbar42/README.md
bash scripts to create VOD HLS stream with ffmpeg almighty (tested on Linux and OS X)

running:

bash create-vod-hls.sh beach.mkv

will produce:

    beach/
      |- playlist.m3u8
 |- 360p.m3u8
@lvnilesh
lvnilesh / nginx.conf
Created June 5, 2021 21:12 — forked from spiermar/nginx.conf
Nginx RMTP to HLS and DASH
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid /var/run/nginx.pid;
events {
@lvnilesh
lvnilesh / nbxplorer.service
Last active April 3, 2021 02:39 — forked from mariodian/nbxplorer.service
NBXplorer Systemd Service
[Unit]
Description=NBXplorer daemon
Requires=bitcoind.service
After=bitcoind.service
[Service]
ExecStart=/usr/bin/dotnet "/home/cloudgenius/NBXplorer/NBXplorer/bin/Release/netcoreapp3.1/NBXplorer.dll" -c /home/cloudgenius/.nbxplorer/Main/settings.config
User=cloudgenius
Group=dialout
Type=simple
// https://developers.cloudflare.com/workers/about/
// https://tutorial.cloudflareworkers.com
//
// A Service Worker which adds Security Headers.
// Checks:
// https://securityheaders.io/
// https://observatory.mozilla.org/
// https://csp-evaluator.withgoogle.com/
// https://hstspreload.org/
// https://www.ssllabs.com/ssltest/
# make temp file that will cause iocage to install some packages
echo '{"pkgs":["ca_root_nss"]}' > /tmp/pkg.json
# create jail
iocage create -n "rslsync" -p /tmp/pkg.json -r 11.3-RELEASE ip4_addr="vnet0|192.168.1.222/24" defaultrouter="192.168.1.1" vnet="on" allow_raw_sockets="1" boot="on"
# remove the temp file
rm /tmp/pkg.json
#make our iocage directories
iocage exec rslsync mkdir -p /config
iocage exec rslsync mkdir -p /mnt/syncdata
@lvnilesh
lvnilesh / react-app-s3-sync.sh
Created March 15, 2020 15:19 — forked from kevindice/react-app-s3-sync.sh
A shell script for uploading a React app build to S3 + CloudFront for deployment
#!/bin/bash
S3_BUCKET_NAME=$1
CF_ID=$2
# Sync all files except for service-worker and index
echo "Uploading files to $S3_BUCKET_NAME..."
aws s3 sync build s3://$S3_BUCKET_NAME/ \
--acl public-read \
--exclude service-worker.js \
@lvnilesh
lvnilesh / README.md
Created March 2, 2020 23:39 — forked from alexellis/README.md
Provision faasd 0.7.5 on DigitalOcean with Terraform 0.12.0
  1. Sign up to DigitalOcean
  2. Download Terraform
  3. Clone this gist using the URL from the address bar
  4. Run terraform init
  5. Run terraform apply -var="do_token=$(cat $HOME/digitalocean-access-token)"
  6. View the output for the login command and gateway URL i.e.
gateway_url = http://178.128.39.201:8080/
login_cmd = faas-cli login -g http://178.128.39.201:8080/ -p rvIU49CEcFcHmqxj
@lvnilesh
lvnilesh / .ssh config
Last active January 15, 2020 21:54 — forked from jkobie/.ssh config
Script to create Cloud Genius workstation from a linux computer
# Created on Mon Jan 13 19:16:24 PST 2020
Host CloudGenius
HostName ec2-52-24-156-230.us-west-2.compute.amazonaws.com
ForwardAgent yes
User ubuntu
StrictHostKeyChecking no
IdentityFile /home/jkobie/.ssh/DoNotUseThisKey-CloudGeniusOnly.pem
Host ec2-52-24-156-230.us-west-2.compute.amazonaws.com
HostName ec2-52-24-156-230.us-west-2.compute.amazonaws.com
IdentityFile /home/jkobie/.ssh/DoNotUseThisKey-CloudGeniusOnly.pem
@lvnilesh
lvnilesh / autofs.md
Created October 9, 2019 22:00 — forked from rudelm/autofs.md
Use autofs on Mac OS X to mount network shares automatically during access

Autofs on Mac OS X

With autofs you can easily mount network volumes upon first access to the folder where you want to mount the volume. Autofs is available for many OS and is preinstalled on Mac OS X so I show you how I mounted my iTunes library folder using this method.

Prepare autofs to use a separate configuration file

autofs needs to be configured so that it knows where to gets its configuration. Edit the file '/etc/auto_master' and add the last line:

#
# Automounter master map
#

+auto_master # Use directory service