Skip to content

Instantly share code, notes, and snippets.

View rnbguy's full-sized avatar

Rano | Ranadeep rnbguy

View GitHub Profile
@rnbguy
rnbguy / spread_loss.sh
Created May 11, 2022 11:10
Computes current loss to burn UST for LUNA
#!/bin/bash
# prints current loss percentage due to burning UST for LUNA
# requires: curl, jq, bc
luna_rate_via_burn=`curl -s "https://fcd.terra.dev/terra/market/v1beta1/swap?ask_denom=uluna&offer_coin=100000000uusd" | jq -r ".return_coin.amount"`
luna_to_ust_exchange_rate=`curl -s "https://fcd.terra.dev/terra/oracle/v1beta1/denoms/uusd/exchange_rate" | jq -r ".exchange_rate"`
echo "(100 - ((${luna_rate_via_burn} * ${luna_to_ust_exchange_rate}) / 10^6))" | bc -l
@rnbguy
rnbguy / bump_pkgver.sh
Created November 5, 2021 15:44
Bump AUR package version
set -e
[ -z $1 ] && echo "no pkgver mentioned" && exit
version="$1"
git checkout PKGBUILD
sed -i "s/pkgver=.*$/pkgver=$version/g" PKGBUILD
checksums=`makepkg -g | sed -E 's/\(/\(\n\t/g ; s/\)/\n\)/g ; s/^[ ]+/\t/g'`
echo $checksums
sed -Ezi "s/[^ \n]+sums=\([^)]+\)\n/$(sed -z 's/\n/\\n/g' <<< $checksums)/g" PKGBUILD
@rnbguy
rnbguy / Dockerfile
Created December 22, 2020 02:03
ERAN on Alpine (ETH Robustness Analyzer for Neural Networks)
FROM alpine
RUN apk update --no-cache
RUN apk add --no-cache git wget build-base automake autoconf libtool mpfr-dev gmp-dev m4 python3 texlive texlive-dvi
WORKDIR /root
ADD ./alpine-install.sh ./alpine-install.sh
RUN ash ./alpine-install.sh
@rnbguy
rnbguy / Dockerfile
Last active December 23, 2020 09:38
ERAN on Arch (ETH Robustness Analyzer for Neural Networks)
FROM archlinux:base-devel
RUN pacman -Syu --noconfirm
# RUN pacman -S --noconfirm m4 gmp mpfr
RUN pacman -S --noconfirm git cddlib tensorflow-opt
RUN useradd -m notroot
RUN echo "notroot ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/notroot
USER notroot
WORKDIR /home/notroot
@rnbguy
rnbguy / wificity_login.sh
Last active September 8, 2021 09:42
bypass WifiCity(CIUP WiFi) Captive Portal
#!/bin/bash
# https://wiki.archlinux.org/index.php/NetworkManager#Captive_portals
# README : make sure these binaries are available on your distribution.
# curl sed
login_wificity() {
# wificity authentication server
authserver="http://10.254.0.254:1000"
@rnbguy
rnbguy / nordvpn.sh
Created February 18, 2020 07:52
Toggle NordVPN using OpenVPN
# make sure you have - openvpn, jq, curl, sed
CURL_CMD='curl -s -H "accept-encoding: gzip, deflate" --compressed'
load() {
security="udp"
cd ~/.nordvpn
rm -f *.ovpn
link="https://downloads.nordcdn.com/configs/files/ovpn_${security}/servers/$1.${security}.ovpn"
filename=nordvpn.conf
@rnbguy
rnbguy / snapshot_isolation.als
Created January 6, 2020 12:19
Alloy spec for Snapshot Isolation
// Alloy spec for Snapshot Isolation
// https://dl.acm.org/doi/10.1145/3360591
// Author of this spec: Ranadeep Biswas & John Wickerson
pred reflexive[r : univ -> univ, s : set univ] { (s <: iden) in r }
pred symmetric[r : univ -> univ] { r in ~r }
pred transitive[r : univ -> univ] { r.r in r }
@rnbguy
rnbguy / dotnet-sdk build for ArchLinux
Last active September 6, 2019 13:16
PKGBUILD for dotnet-sdk
# Maintainer: Ranadeep Biswas <ranadip.bswas@gmail.com>
pkgname=dotnet-sdk
pkgver=2.2.401
pkgrel=1
pkgdesc='.NET Core is a cross-platform version of .NET for building websites, services, and console apps.'
arch=('x86_64')
url='https://dotnet.microsoft.com'
license=('MIT')
provides=('dotnet-sdk')
conflicts=('dotnet-sdk')
@rnbguy
rnbguy / !SOCKS5_proxy_sigavpn.md
Last active June 10, 2019 02:06
SOCKS5 proxy for SigaVPN

Creates a socks5 proxy at localhost:1081 for SigaVPN.

If you want to use any other port, just replace 1081 in the docker compose file with your desired port.

If you want to use a specific server, change CODE to that country code or the unique code from your ovpn link.

  • If you want to connect to the second free server of New York, use CODE=ny2.
  • If you have a link https://ovpn.sigavpn.com/a1b2c3d.php from Siga admin, use CODE=a1b2c3d.
  • Default CODE is nl1.
docker-compose file for Ubuntu.
Goes with `http://labs.play-with-docker.com?stack={LINK}`