Skip to content

Instantly share code, notes, and snippets.

View mcnemesis's full-sized avatar
💭
v:TEA|h:{know some u:code poetry?}|g!:_*\0/*_

Nemesis Fixx Da JWL mcnemesis

💭
v:TEA|h:{know some u:code poetry?}|g!:_*\0/*_
View GitHub Profile
@mcnemesis
mcnemesis / lines_to_pythonic_list.sh
Created February 20, 2020 15:02
Transform a file of lines into a pythonic-list of comma delimited strings on the command line
cat old_db_tables.list.txt |sed -e 's/^/"/;s/$/"/'| tr '\n' ','|sed 's/^/[/;s/$/]/'
@mcnemesis
mcnemesis / generate_rand_bool_matrix.r
Last active April 23, 2019 09:27
A method to generate stochastic boolean matrices in R
library(openssl)
matrix(sapply(c(rand_num(100)), (function(n) (round(n*100)%%2))), nrow=5)
@mcnemesis
mcnemesis / last_log
Created April 11, 2019 07:40
for those times you need a handy utility to preview logs on the way to doing other things...
# nuchwezilabs ## for those times you need a handy utility to preview logs on the way to doing other things...
#alias lastlog="tail -n 20 $(ls -d -t -1 "$PWD/logs/"** | sed -n '2p')"
#nu method...
function lastlog() {
tail -n 20 $(ls -d -t -1 $(pwd)/logs/** | sed -n '2p')
}
@mcnemesis
mcnemesis / apply_margins
Last active March 27, 2019 18:58
Exploring R: apply()
# Construct a 5x6 matrix
X <-matrix(rnorm(30), nrow=5, ncol=6)
# Sum the values of each row with `apply()`
X2 <- apply(X, 1, sum)
NROW(X2)
NCOL(X2)
# So the same for each row
X3 <- apply(X, 2, sum)
alias lastlog="tail -n 20 $(ls -d -t -1 "$PWD/logs/"** | sed -n '2p')"
# CONSIDER THIS AN EXAMPLE ... replace variables with own vals
az account set -s <SUBSCRIPTION_ID>
az vm deallocate --resource-group TWEBBUILDER --name TWEBBUILDERVM
az vm list -g TWEBBUILDER --query '[].{Name:name,DiskName:storageProfile.osDisk.name}' --output table
az disk create -g TWEBBUILDER_GALL --name TWEBBUILDER_GALL_disk --source /subscriptions/<SUBSCRIPTION_ID>/resourceGroups/TWEBBUILDER/providers/Microsoft.Compute/snapshots/TWBSnap
az disk list -g TWEBBUILDER_GALL --output table
az network vnet create -g TWEBBUILDER_GALL --location westeurope --name TWBGALLVNet --address-prefix 192.168.0.0/16 --subnet-name TWBGALLSubNet --subnet-prefix 192.168.1.0/24
az network public-ip create -g TWEBBUILDER_GALL --location westeurope --name TWBGALLIP --dns-name twbgallery --allocation-method static --idle-timeout 4
az network nic create -g TWEBBUILDER_GALL --location westeurope --name TWBGallNic --vnet-name TWBGALLVNet --subnet TWBGALLSubNet --public-ip-address TWBGALLIP
az vm create -g TWEBBUILDER_GALL --name TW
@mcnemesis
mcnemesis / umap_sparse.py
Created August 22, 2018 16:50 — forked from johnhw/umap_sparse.py
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@mcnemesis
mcnemesis / index.html
Created December 14, 2017 18:04
NGOMA
<!-- msg template -->
<script type="text/template" id="msg_template">
<li class="content">
<p class="img" style='background-image: url("<%= img %>")'> </p>
<p class="msg"><%= msg %></p>
</li>
</script>
<!-- main html -->
<a href="https://github.com/uriuriuriu/beat.js" target="_blank"><h1 id="title">NuChwezi Chan</h1></a>