Skip to content

Instantly share code, notes, and snippets.

View jaybuidl's full-sized avatar
📐

jaybuidl jaybuidl

📐
View GitHub Profile
@jaybuidl
jaybuidl / autossh.service
Created February 18, 2020 08:13 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
//install ipfs-cluster
cd $HOME
wget https://dist.ipfs.io/go-ipfs/v0.4.14-rc1/go-ipfs_v0.4.14-rc1_linux-amd64.tar.gz
tar xf go-ipfs_v0.4.14-rc1_linux-amd64.tar.gz
sudo mv go-ipfs/ipfs /usr/local/bin/ipfs
ipfs init
//installing go
cd $HOME/ && wget https://storage.googleapis.com/golang/go1.10.1.linux-amd64.tar.gz
@jaybuidl
jaybuidl / OrderTest.java
Last active January 11, 2019 17:09
Expected behaviour of order entry by units or amount, input validation and 2-ways conversion
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
public
class OrderTest
{
@jaybuidl
jaybuidl / install-openjdk-11-locally.sh
Created September 27, 2018 10:01
Installs the official OpenJDK 11 binary package and run update-alternatives on a debian system for all java executables
cd ~/Downloads
wget https://download.java.net/java/GA/jdk11/28/GPL/openjdk-11+28_linux-x64_bin.tar.gz
cd /usr/lib/jvm
sudo tar -xvf ~/Downloads/openjdk-11+28_linux-x64_bin.tar.gz
for f in $(find /usr/lib/jvm/jdk-11/bin/ -executable -type f)
do
baseName="$(basename $f)"
echo "setting up $baseName"
@jaybuidl
jaybuidl / get-prices.sh
Last active February 6, 2022 17:25
Live prices download from Alpha Vantage
#!/bin/bash
# precondition: jq installed
pkg="jq"
if [[ $(dpkg-query -W -f='${Status}' $pkg 2>/dev/null) != "install ok installed" ]];
then
echo "$pkg package not found: installing"
if sudo apt-get install -y $pkg;
then
echo "$pkg installation successful, continuing...";
import org.sonatype.nexus.repository.storage.StorageFacet;
import org.sonatype.nexus.repository.storage.Query;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
def fmt = DateTimeFormat.forPattern('yyyy-MM-dd HH:mm:ss');
// Get a repository
def repo = repository.repositoryManager.get('nuget-releases');
// Get a database transaction
def tx = repo.facet(StorageFacet).txSupplier().get();
@jaybuidl
jaybuidl / ubuntu_lsb_release.sh
Last active January 16, 2018 08:14
Runs lsb_release on the upstream distribution
#!/bin/bash
#for example "ubuntu_lsb_release -c -s" gives the ubuntu codename such as xenial or trusty
if [ ! -f /etc/upstream-release/lsb-release ]
then
# this is already ubuntu, delegate
/usr/bin/lsb_release $@
exit 0
fi
@jaybuidl
jaybuidl / reinstall-microsoft-r-open.sh
Created April 28, 2017 05:46
fixes upgrade problems for MS R Open
#!/bin/bash
# official website: https://mran.microsoft.com/documents/rro/installation/#revorinst-lin
# fix package manager
sudo rm -rf /var/lib/dpkg/info/microsoft-r-open-*
sudo dpkg --remove --force-remove-reinstreq microsoft-r-open-mkl-3.3
sudo dpkg --remove --force-remove-reinstreq microsoft-r-open-foreachiterators-3.3
sudo dpkg --remove --force-remove-reinstreq microsoft-r-open-mro-3.3
@jaybuidl
jaybuidl / update-docker-compose.sh
Last active January 16, 2018 08:30
update docker-compose and its auto-completion to the latest release version (not installed as a container!)
#!/bin/bash
latestReleaseUrl="$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep "docker-compose-Linux-x86_64\"" | grep browser_download_url | sed "s/.*\(https.*x86_64\).*/\1/")"
echo "installing $latestReleaseUrl"
sudo curl -L $latestReleaseUrl -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose version
#!/bin/bash
# with ansible role from https://galaxy.ansible.com/wtanaka/vagrant
ansible-galaxy install wtanaka.vagrant
#--------------
# or manually
version=1.9.1