Skip to content

Instantly share code, notes, and snippets.

Param(
[Parameter(Mandatory=$true)]
[string]$FileOwner,
[string]$Unlock
)
$Shares = Get-WmiObject -Class win32_share -filter "type=0 and not name like 'PRINT$' and not name like 'SYSVOL' and not name like 'NETLOGON'"
if ($Unlock) {
ForEach ($Share in $Shares) {
UnBlock-SmbShareAccess -Name $Share.Name -AccountName $FileOwner -force
}
# sh /code/run.sh
[value] Analyzing a complete application starting at main
[value] Computing initial state
[value] Initial state computed
/code/src/test.c:59:[value] warning: argument version has type int but format indicates unsigned int
[value] warning: Continuing analysis because this seems innocuous
Test Argon2i version number: 13
# Source
#include <stdio.h>
#include <stdlib.h>
struct node {
int something;
struct node *next;
};
#!/usr/bin/env ruby
require 'openssl'
def subject_alt_name(domains)
domains = domains.split(/,/)
ef = OpenSSL::X509::ExtensionFactory.new
ef.create_extension("subjectAltName",
domains.map { |d| "DNS: #{d}" }.join(','))
@technion
technion / size_t.c
Last active February 25, 2017 08:20
#include <stdio.h>
#include <unistd.h>
int returnsnegative() {
return -5;
}
ssize_t my_write(int fd, const void *buf, size_t count) {
/* This functions has the same function prototype as write() */
/* For more information: https://linux.die.net/man/2/write */
#!/usr/bin/env ruby
("1000000000".to_i(16)).upto("FFFFFFFFFF".to_i(16)) do |n|
puts n.to_s(16).upcase
puts n.to_s(16)
end
module ApplicationHelper
# Use a hash so there's a bit of work to serialize
DATA = [data: 'a secret cookie', second: 'another string']
N = 100000
def storebench
# Setup keying. Really, secret and sign_secret should just get saved.
key_generator = ActiveSupport::KeyGenerator.new(Rails.application.secrets.secret_key_base, iterations: 1000)
secret = key_generator.generate_key('encrypted cookie')
sign_secret = key_generator.generate_key('signed encrypted cookie')
$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