Skip to content

Instantly share code, notes, and snippets.

View lawrencegripper's full-sized avatar

Lawrence Gripper lawrencegripper

View GitHub Profile
@lawrencegripper
lawrencegripper / dns_check.sh
Last active September 5, 2018 19:29
DNS check - Check DNS entry matches your public ip
#!/bin/sh
set -e
export DNS_NAME=$1
IP="NOTSET"
DNS_IP=$(nslookup $DNS_NAME 8.8.8.8 | awk -F': ' 'NR==5 { print $2 } ')
echo "Checking DNS - IP: $IP DNS_IP: $DNS_IP DNS_NAME: $DNS_NAME"
ATTEMPTS=25
I=0
@lawrencegripper
lawrencegripper / setup.bash
Created September 5, 2018 14:07
Ubuntu Setup Macbook
set -e
cp ~/.bashrc .bashrc_backup
echo "Theme"
sudo add-apt-repository ppa:tista/adapta -y
sudo apt-get update
sudo apt-get install adapta-backgrounds adapta-gtk-theme -y
gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false
@lawrencegripper
lawrencegripper / make_writable.js
Last active July 12, 2023 23:00 — forked from moehlone/make_writable.js
Make JavaScript readonly propertys writable (example for overwriting navigator.userAgent; useful for unit tests -> browser detection)
/**
* Creates a read/writable property which returns a function set for write/set (assignment)
* and read/get access on a variable
*
* @param {Any} value initial value of the property
*/
function createProperty(value) {
var _value = value;
/**
@lawrencegripper
lawrencegripper / init.sh
Last active May 25, 2018 14:37
CUDAInstallUbuntu
export DEBIAN_FRONTEND=noninteractive
export TEMP_DISK=/mnt
apt-get install -y -q --no-install-recommends \
build-essential
# Add dockerce repo
apt-get update -y -q --no-install-recommends
apt-get install -y -q -o Dpkg::Options::="--force-confnew" --no-install-recommends \
echo "Hello World"
@lawrencegripper
lawrencegripper / launch.json
Last active August 21, 2024 08:44
Golang debugging in VSCode with Arguments
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch",
"type": "go",
"request": "launch",
"mode": "debug",
"remotePath": "",
@lawrencegripper
lawrencegripper / init.sh
Last active October 23, 2017 10:44
Using .IMG files with Azure Files and Container instances
#!/bin/sh
#!/bin/bash
# $1 = Azure storage account name
# $2 = Azure storage account key
# $3 = Azure file share name
# $4 = mountpoint path
mkdir -p $4
# CIFS settings from Azure CloudShell container which uses .img approach.
mount -t cifs //$1.file.core.windows.net/$3 $4 -o vers=2.1,username=$1,password=$2,sec=ntlmssp,cache=strict,domain=X,uid=0,noforceuid,gid=0,noforcegid,file_mode=0777,dir_mode=0777,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,echo_interval=60,actimeo=1
@lawrencegripper
lawrencegripper / UpdateHyperKubeImage.sh
Last active July 21, 2017 12:15
Quick and Dirty Kubernetes Update script
CURRENT="khenidak/hyperkube-amd64:kv1.5"
NEW="gcrio.azureedge.net/google_containers/hyperkube-amd64:v1.7.0"
SEDPATTERN="s|$CURRENT|$NEW|g"
sudo systemctl stop kubelet.service
sudo sed -i $SEDPATTERN /etc/kubernetes/manifests/*
sudo sed -i $SEDPATTERN /etc/kubernetes/addons/*
sudo sed -i $SEDPATTERN /etc/default/kubelet
sudo systemctl daemon-reload
$resourceGroupName = "some-deployment-group"
Login-AzureRmAccount
Save-AzureRmProfile "$PSScriptRoot\.azureprofile"
function Delete-History {
$batch = 80
Get-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName | ForEach-Object {
$batch = $batch -1
Login-AzureRmAccount
Save-AzureRmProfile "$PSScriptRoot\.lgazureprofile"
Get-AzureRmResourceGroupDeployment -ResourceGroupName "something" | ForEach-Object { Start-
Job -ScriptBlock {
param($deployment)
Select-AzureRmProfile -Path "$PSScriptRoot\.lgazureprofile"
$deployment | Remove-AzureRmResourceGroupDeployment
} -ArgumentList $_ }