Skip to content

Instantly share code, notes, and snippets.

View Strykar's full-sized avatar
💭
What is Bash?

Avinash H. Duduskar Strykar

💭
What is Bash?
  • India
View GitHub Profile
@Strykar
Strykar / environment
Created September 30, 2021 11:39
Livepeer systemd environment
ethaddr=0x1a00000000000000000000000000000000000000
ethurl=https://mainnet.infura.io/v3/00000000000011111111110000000000
ethpass=mywalletpassword
maxgas=40000000000
unitprice=800
serviceaddr=my.livepeer.node:8935
sesh=6
cliaddr=192.168.10.1:7935
rew=false
mon=false
@Strykar
Strykar / livepeer.service
Last active September 30, 2021 11:58
Livepeer systemd service
[Unit]
Description=Start the Go-Livepeer Orchestrator and Transcoder service
After=network.target
Wants=network-online.target
# See https://www.cyberciti.biz/faq/linux-hide-processes-from-other-users/
[Service]
Restart=always
Type=simple
EnvironmentFile=/etc/go-livepeer/environment
# Maintainer: Strykar <strykar@hotmail.com>
pkgname=go-livepeer-bin
_pkgname=go-livepeer
pkgver=0.5.21
pkgrel=1
pkgdesc='Official Go binaries of the Livepeer protocol'
arch=('x86_64')
url='https://github.com/livepeer/go-livepeer'
license=('MIT')
@Strykar
Strykar / upgrade_livepeer.sh
Last active October 16, 2023 11:13
Upgrade Livepeer Go binaries. Run as: $ upgrade_livepeer.sh 4efbda6d5e6586e7eb1e6ccbd526da65cdbe2e4e27a01cb76b1f2893fe790fdb
#!/bin/bash
# Download, extract and update Livepeer binary from Github to a pre-existing directory you set below
# It assumes you have extracted the previous livpeer tar.gz in it and run livepeer from the same directory
# Not intended to be run as root
#
# Expects bash, jq, curl, grep, sed, sha256sum and tar to be installed, usually available even on embedded systems
# Windows Subsystem for Linux (WSL) or Cygwin should provide every utility on Windows
# shellcheck disable=SC2015
set -euf -o pipefail
@Strykar
Strykar / myruleset.nft
Last active June 22, 2021 12:12
Create a set similar to ipset in nftables for large IP groups
# ASN 18207 YouBroadBand
# 103.247.210.0/24
# 103.39.4.0/23
# 103.48.96.0/22
# 103.5.70.0/24
# 123.201.0.0/16
# 150.107.208.0/22
# 175.100.128.0/19
# 196.1.104.0/24
# 203.109.64.0/18
@Strykar
Strykar / server_nftables.sh
Last active May 20, 2022 09:09
Server firewall using nftables
#!/usr/sbin/nft -f
## vim: ft=pf
flush ruleset
define wan = eth0
define cjd = tun0
define wg_int = wg0
define vpn_gw = 192.168.10.1
define vpn_net = 192.168.10.0/24
define proto_allow = { ah, esp, igmp, ipv6 }
#!/hint/bash
#
# /etc/makepkg.conf
#
#########################################################################
# SOURCE ACQUISITION
#########################################################################
#
#-- The download utilities that makepkg should use to acquire sources
[Unit]
Description=AutoSSH service to remotely access signald's unix socket for weechat's signal.py (/smsg +145789323231)
After=network-online.target
# Use this instead if autossh will interact with the local SSH server
# After=network-online.target sshd.service
[Service]
Environment="AUTOSSH_GATETIME=30"
Environment="AUTOSSH_POLL=30"
Environment="AUTOSSH_FIRST_POLL=30"
@Strykar
Strykar / _README.md
Last active January 14, 2021 02:39
Bash General-Purpose Yes/No Prompt Function ("ask")

This is a general-purpose function to ask Yes/No questions in Bash, either with or without a default answer. It keeps repeating the question until it gets a valid answer.

@Strykar
Strykar / gist:377ba77479e974326cb19aa894c8ee79
Created December 29, 2020 03:12
gawk crushing busybox awk
root@apu:~# time awk 'BEGIN { OFMT = "%.0f"; for (i = 0; i < 50000; i++) print (95/100 * 42) }' > /dev/null
real 0m0.517s
user 0m0.435s
sys 0m0.081s
root@apu:~# time awk 'BEGIN { for (i = 0; i < 50000; i++) printf("%.0f\n", (95/100 * 42)) }' > /dev/null
real 0m0.862s
user 0m0.624s
sys 0m0.237s