Skip to content

Instantly share code, notes, and snippets.

Nemesis Fixx mcnemesis

Block or report user

Report or block mcnemesis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mcnemesis
mcnemesis / MainActivity.java
Created May 27, 2020
Example Activity using the DNAP Histrion as an embed
View MainActivity.java
package com.nuchwezi.nulabs;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@mcnemesis
mcnemesis / lines_to_pythonic_list.sh
Created Feb 20, 2020
Transform a file of lines into a pythonic-list of comma delimited strings on the command line
View lines_to_pythonic_list.sh
cat old_db_tables.list.txt |sed -e 's/^/"/;s/$/"/'| tr '\n' ','|sed 's/^/[/;s/$/]/'
@mcnemesis
mcnemesis / generate_rand_bool_matrix.r
Last active Apr 23, 2019
A method to generate stochastic boolean matrices in R
View generate_rand_bool_matrix.r
library(openssl)
matrix(sapply(c(rand_num(100)), (function(n) (round(n*100)%%2))), nrow=5)
@mcnemesis
mcnemesis / last_log
Created Apr 11, 2019
for those times you need a handy utility to preview logs on the way to doing other things...
View last_log
# 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 Mar 27, 2019
Exploring R: apply()
View apply_margins
# 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)
View New Azure VM From Existing Azure VM Disk
# 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 / uganda_districts.txt
Created Jun 4, 2014
List of all current (as of 2014) Uganda's Districts - useful in forms-authoring and other tasks of your liking (source : http://www.statoids.com/uug.html)
View uganda_districts.txt
Abim
Adjumani
Agago
Alebtong
Amolatar
Amudat
Amuria
Amuru
Apac
Arua
@mcnemesis
mcnemesis / RESTAPI.cs
Created Aug 16, 2013
1-File Robust RESTful API internal layer for Windows Phone 8
View RESTAPI.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
namespace RESTAPI
{
/// <summary>
/// Encapsulates functionality to make it possible to make
You can’t perform that action at this time.