Skip to content

Instantly share code, notes, and snippets.

View rnbguy's full-sized avatar

Rano | Ranadeep rnbguy

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / ralign.py
Created February 14, 2018 14:43 — forked from CarloNicolini/ralign
Umeyama algorithm for absolute orientation problem in Python
import numpy as np
"""
RALIGN - Rigid alignment of two sets of points in k-dimensional
Euclidean space. Given two sets of points in
correspondence, this function computes the scaling,
rotation, and translation that define the transform TR
that minimizes the sum of squared errors between TR(X)
and its corresponding points in Y. This routine takes
O(n k^3)-time.
@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 / !Acestream_vpn_docker.md
Last active July 10, 2019 15:57
Acestream docker with SigaVPN

A simple fire-and-forget docker-compose setup for AceStream with VPN.

Just type docker-compose up and hit enter!

6878 port will be available within the local network as well (great for casting).