Skip to content

Instantly share code, notes, and snippets.

@vsivsi
vsivsi / rename_bad.go
Created June 20, 2023 19:49
Rename files in CWD to remove characters forbidden by OneDrive
func main() {
dir := "./"
bad := "\"*:<>?/\\|"
files, err := os.ReadDir(dir)
if err != nil {
panic(err)
}
@vsivsi
vsivsi / README.md
Last active November 4, 2021 20:44
GNU C / Asm test of AVX512 opmask clobbering on Darwin

GNU C / Asm test of AVX512 opmask clobbering on Darwin

This is an alternative implemenation of: https://gist.github.com/vsivsi/fff8618ace4b02eb410dd8792779bf32

NOTE! This must be run on an Intel processor supporting AVX512F/DQ

Build and run (in background): gcc testmask.c testmask.s && ./a.out &

Send a bunch of SIGURG signals: for ((x=0;x<20;x++)); do kill -s URG <pid>; sleep 0.01; done

@vsivsi
vsivsi / README.md
Last active November 4, 2021 20:48
Reproduction of AVX512 opmask clobbering

Maskcheck is a repro of opmask clobbering by golang async preemption

A GNU C / Asm implementation is here: https://gist.github.com/vsivsi/8511aca1bac528f49fbb45a636afa4b5

NOTE! This must be run on an Intel processor supporting AVX512F/DQ

To test: go test -count 1 -timeout 15m -run '^TestMask$' gist.github.com/vsivsi/fff8618ace4b02eb410dd8792779bf32

This should fail with something like:

<Instruction name="VPOPCNTD" summary="Packed Population Count for Doubleword Integers">
<InstructionForm gas-name="vpopcntd" xmm-mode="AVX">
<ISA id="AVX512VPOPCNTDQ"/>
<ISA id="AVX512VL"/>
<Operand type="xmm{k}{z}" input="false" output="true"/>
<Operand type="m128/m32bcst" input="true" output="false"/>
<Encoding>
<EVEX mm="10" pp="01" LL="00" W="0" vvvv="0000" V="0" RR="#0" B="#1" X="#1" b="#1" aaa="#0" z="#0" disp8xN="16"/>
<Opcode byte="55"/>
<ModRM mode="#1" reg="#0" rm="#1"/>
@vsivsi
vsivsi / vegalite.ipynb
Last active April 17, 2020 06:55
Gophernotes + VegaLite = Awesome
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@vsivsi
vsivsi / badplot.ipynb
Created February 24, 2020 18:32
Repro of gophernotes + gonum/plot issue
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vsivsi
vsivsi / outline.md
Last active March 14, 2018 21:53
Problem statements

Defining and Defending Project Scope


This is one of the most critical things!


  • Problem Statement(s)
  • Formal documentation of Project Scope
@vsivsi
vsivsi / debug.txt
Created May 25, 2017 18:09
debug output
$ terraform apply
nomad_job.import_snapshot: Refreshing state... (ID: import_snapshot)
nomad_job.import_snapshot: Modifying... (ID: import_snapshot)
nomad_job.import_snapshot: Modifications complete (ID: import_snapshot)
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
@vsivsi
vsivsi / system-update.sh
Created May 21, 2017 00:20
Mac OS post install
# Run this file once. It will restart to finish the MacOS update
# If the developer tools are already installed, it does nothing. So it is safe to run it again.
# Get the names from HOSTNAME env, which comes from DNS reverse lookup
sudo scutil --set ComputerName $HOSTNAME
sudo scutil --set HostName $HOSTNAME
sudo scutil --set LocalHostName $HOSTNAME
# This sets the system clock to UTC, although the System Preferences UI won't show it.
# sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime