Skip to content

Instantly share code, notes, and snippets.

@AStupidBear
AStupidBear / SpikingNetworksTutorial.ipynb
Last active March 15, 2016 06:59
Tutorial for SpikingNetwork.jl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import MPI
function do_sendrecv(N)
comm = MPI.COMM_WORLD
MPI.Barrier(comm)
rank = MPI.Comm_rank(comm)
size = MPI.Comm_size(comm)
addprocs(1)
@everywhere function echo_on_sock(s, N)
while true
try
read(s, Float64, (N,))
write(s, fill(Float64(myid()), N))
catch e
#println("closed by remote $e")
addprocs(1)
const rr1=RemoteRef()
const rr2=RemoteRef(2)
@everywhere function do_sendrecv(N, rr1, rr2)
myid() == 1 && print("$N : ")
if myid() == 1
rr_put = rr2
@AStupidBear
AStupidBear / mysshpass.py
Created February 26, 2018 05:45 — forked from jlinoff/mysshpass.py
Simple python script to emulate sshpass using only pthon standard libraries, tested on python-2.7 and python-3.4.
#!/usr/bin/env python
# License: MIT Open Source
# Copyright (c) 2016 Joe Linoff
'''
The tool runs ssh or scp as a child process with a connected psuedo
terminal (pty).
It will automatically answer yes to the "Are you sure you want to
continue connecting (yes/no)?" if it comes up.
cd /tmp
wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz
tar zxvf cmake-3.*
cd cmake-3.*
./bootstrap --prefix=/usr/local
make -j$(nproc)
make install
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest "https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.0.0.0p1-Beta/OpenSSH-Win64.zip" -OutFile OpenSSH-Win64.zip
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
Unzip OpenSSH-Win64.zip "C:\Program Files\"
@AStupidBear
AStupidBear / elemental-install.sh
Created October 6, 2019 11:32
Install Elemental for Julia
#!/bin/bash
julia -e 'using Pkg; Pkg.rm("Elemental"); Pkg.gc(); Pkg.add("Elemental")'
script="$JULIA_DEPOT_PATH/packages/Elemental/*/deps/build.jl"
sed -i 's:79987d38b04838acf6b6195be1967177521ee908:477e503a7a840cc1a75173552711b980505a0b06:g' $script
sed -i 's:-D PYTHON_EXECUTABLE="":-D PYTHON_EXECUTABLE=""\n-D EL_DISABLE_PARMETIS=ON:g' $script
julia -e 'using Pkg; Pkg.build("Elemental")'
sed -i 's:\n-D EL_DISABLE_PARMETIS=ON::g' $script
sed -i 's:477e503a7a840cc1a75173552711b980505a0b06:79987d38b04838acf6b6195be1967177521ee908:g' $script
@AStupidBear
AStupidBear / sysbench.sh
Created December 19, 2019 14:04
system benchmark
#!/usr/bin/sudo bash
mkdir sysbench && cd sysbench
# install docker
if ! which docker; then
apt-get install docker.io hardinfo
fi
if ! which nvidia-container-cli; then
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
@AStupidBear
AStupidBear / plots-compile.jl
Last active March 30, 2020 04:03
Compile Plots.jl to shorten first-to-plot time
#!/usr/bin/env julia
using Pkg
pkg"add PackageCompiler Plots StatsPlots PyPlot"
using PackageCompiler
snoop = tempname()
open(snoop, "w") do fid
println(fid, "using Plots")
println(fid, "p=plot(rand(5), rand(5))")