Skip to content

Instantly share code, notes, and snippets.

View ddworken's full-sized avatar
💭
🔒

David Dworken ddworken

💭
🔒
View GitHub Profile
@ddworken
ddworken / allow-unique-origins-and-blob-headers.md
Last active March 15, 2023 20:57
Sandbox allow-unique-origin and customizing Blob response headers

Sandbox allow-unique-origin and customizing Blob response headers

A Web Platform API proposal to improve sandboxing and Blob URL

David Dworken, Feb 2023 (©2023, Google)

TL;DR: Add a allow-unique-origin sandbox directive and response headers to Blob URLs

allow-unique-origin sandbox directive

#!/bin/bash
if $(/usr/sbin/service openvpn status | grep -q 'Active: active'); then
/usr/sbin/service openvpn stop
else
/usr/sbin/service openvpn start
fi
from PIL import Image
def average(filename):
colorOutput = {'r':-1, 'b':-1, 'g':-1}
image = Image.open(filename)
for channel in range(3):
channelPixels = [pixel for pixel in image.getdata(band=channel)]
colorOutput[colorOutput.keys()[channel]] = sum(channelPixels) / len(channelPixels)
return colorOutput
@ddworken
ddworken / gist:c40452d4ec2721394db5
Created November 25, 2015 00:51
Start a chroot
sudo mount /dev/sda1 /mnt
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -o bind /dev /mnt/dev
cp -L /etc/resolv.conf /mnt/etc/resolv.conf
chroot /mnt /bin/bash
#include <Servo.h> // needed to interface with the servos
const int lowerSensorPin = 2; //pin that the first switch is attached to
const int upperSensorPin = 3; //pin that the second switch is attach to
const int lowerServoPin = 5; //pin that the first servo is attаched to
ⅽonst int upperServoPin = 6; //pin that the second servo is attached to
Servo lowerServo; //init the first/lower servo
Servo upperServo; //init the second/upper servo
#include <Servo.h>
const int lowerSensorPin = 2;
const int upperSensorPin = 3;
const int lowerServoPin = 5;
const int upperServoPin = 6;
Servo lowerServo;
Servo upperServo;
@ddworken
ddworken / keybase.md
Last active August 29, 2015 14:18
keybase.md

Keybase proof

I hereby claim:

  • I am ddworken on github.
  • I am dworken (https://keybase.io/dworken) on keybase.
  • I have a public key whose fingerprint is 0E5C 6E48 0288 3063 466F 9B2B ABCE 8A7D 0204 19CF

To claim this, I am signing this object:

@ddworken
ddworken / michael.py
Created January 19, 2015 17:38
Matrix cosine to the p
#!/bin/python
import sys
import pprint
import math
inArr = []
matrix = [[0 for x in range(len(sys.argv)-1)] for x in range(len(sys.argv)-1)]
p = float(sys.argv[1])
sum = 0