Skip to content

Instantly share code, notes, and snippets.

$VMs = import-csv -path '.\build list.csv'
$VMLOC = "C:\ClusterStorage\GoldTier03\iuhuih\"
$ISO = "C:\ClusterStorage\SilverTier1\ISO\SW_DVD9_Win_Svr_STD_Core_and_DataCtr_Core_2016_64Bit_English_-3_MLF_X21-30350.ISO"
foreach ($vm in $VMs) {
write-host "Creating VM " $vm.Name "With C: " $vm.C "and ram" $vm.RAM
$disksize = [int]$($vm.C) * 1024*1024*1024 #Convert byte string to GB
New-VM -Name $vm.Name -Path ${VMLOC} -MemoryStartupBytes 2GB -NewVHDSizeBytes $disksize -SwitchName vSwitch1 -Generation 2 -NewVHDPath "$($VMLOC)$($vm.Name)\disk-1.vhdx"
Get-VM -VM $vm.Name | Set-VMNetworkAdapterVlan -Access -Vlanid 1205
$ramsize = [int]$($vm.RAM) * 1024*1024*1014 #Convert byte string to GB
@technion
technion / dial.erl
Created April 28, 2018 09:13
Erlang dialyzer demo
dial.erl
-module(dial).
-export([dial/0]).
addthree(X) ->
X + 3.
dial() ->
Y = addthree(2),
io:fwrite("~p~n", [Y]).
@technion
technion / getzones.rb
Created June 6, 2018 02:44
Export all Route 53 zones
#!/usr/bin/env ruby
zones = `./cli53-linux-amd64 l --profile d53`.lines
zones.each do |zone|
domain = zone.split(/\s+/)[1]
`./cli53-linux-amd64 export #{domain} --profile d53 > #{domain}.zone`
puts domain
end
@technion
technion / modeven.v
Last active June 7, 2018 10:58
Mod Even
Require Import Coq.Arith.Arith.
Require Import Coq.Arith.EqNat.
(* Definition from : https://coq.inria.fr/library/Coq.Arith.Even.html *)
Inductive even : nat -> Prop :=
| even_O : even 0
| even_S : forall n, odd n -> even (S n)
with odd : nat -> Prop :=
odd_S : forall n, even n -> odd (S n).
@technion
technion / Crypto Cheat Sheet.md
Last active October 21, 2018 08:52
Crypto cheat sheet

Weaknesses

ECB mode - unauthenticated Cut and paste blocks Chosen plaintext - use length controlled input for byte at a time decryption

CBC mode - unauthenticated Bitflipping attack to alter message CBC padding oracle decryption

@technion
technion / Get-VM-using-Virtualdisk.ps1
Last active August 5, 2020 00:55
Scan a virtualdisk for VMs that are using it
# Please set these two variables
$scanpath = "C:\ClusterStorage\SilverTier1"
$clustername = "cls.cluster.mycluster.cluster.cls"
Set-StrictMode -Version 2
$nodes = Get-ClusterNode -Cluster $clustername
foreach ($node in $nodes) {
write-host "Processing node $($node.Name)"
[00012937][01 00] Firmware upgrade finished successfully.
[00013055]Done.
[00013086]Packet [C:\P3S_FW_V01.11.0020.bin] resumed, card sn [0x90ce7f72].
[00013128]Packet vlink 01.11.0020 <-> 01.11.0020.
[00013202]Version checking[2]...
[00013262][03 06][00] v2.1.6.18 -> v2.4.20.50 need upgrade.
[00013322][03 05][00] v34.2.0.9 -> v34.2.0.9
[00013369][04 00][00] v1.38.0.0 -> v1.48.0.0 need upgrade.
[00013463][11 00][00] v1.6.1.0 -> v1.8.0.0 need upgrade.
! function(a, b) {
var c = function(a) {
function b(a) {
return c() + "-" + d() + "-" + e() + "-" + f() + "-" + g(a)
}
function c() {
var a = new Date,
b = Math.round(a.getTime() / 1e3); //to seconds rounded
b = parseInt(b.toString().slice(1)), //remove leading precision .. todo: substring
#!/usr/bin/env ruby
INTEST = '5 10 20 50-60 70-73 75-79 80 95'.freeze
OUTTEST = '5 10 20 50 51 52 53 54 55 56 57 58 59 60 70 71 72 73 75 76 77 78 79 80 95'.freeze
def rangeconvert(r)
start, finish = r.scan(/\d+/)
raise "Invalid input" unless start < finish
(start..finish).to_a.join(' ')
end
@technion
technion / assertions.c
Created April 27, 2019 07:36
Assertion testing
$ cat assertion.c
#include <stdio.h>
#include <assert.h>
int main()
{
int i = 7;
assert(i > 10);
printf("Just printing something\n");
return 0;