Skip to content

Instantly share code, notes, and snippets.

View tomayac's full-sized avatar

Thomas Steiner tomayac

View GitHub Profile
@tomayac
tomayac / enel-x-way-api.md
Last active March 30, 2024 04:32
Reverse-engineering the Enel X Way API

Reverse-engineering the Enel X Way API

These API endpoints were extracted from decompiling the Enel X Way Android app.

Authentication

https://emobility.enelx.com/api/authentication/v2/oauth/refreshToken
@tomayac
tomayac / #intro.md
Last active December 18, 2022 07:22
Snippet repository

There are many code snippets which can be quickly used to show/demo stuff in Chrome for demos or pitches, or just debugging, QA and testing. This is a collection of such snippets with some instructions Snippets can be saved to Chrome and run via one click again!

How to use snippets in Chrome

  • Open Command Menu in DevTools
  • Apple-Shift-P
  • Pick "Create new snippet"
@tomayac
tomayac / gist:1205635
Created September 9, 2011 06:48
POST to DBpedia Spotlight
# This is what I try:
curl -i -X POST -d "text=dbpedia+spotlight+is+neat.&confidence=0.2&support=10" -H "Accept:application/json" -H "Content-Type:application/x-www-form-urlencoded" http://spotlight.dbpedia.org/rest/annotate
# This is what I get:
HTTP/1.1 415 Unsupported Media Type
Date: Fri, 09 Sep 2011 06:46:25 GMT
Transfer-Encoding: chunked
Content-Type: text/plain
# What is the correct "Content-Type" header if not "application/x-www-form-urlencoded"?
#!/bin/bash
# Downloads the latest Chromium build for macOS and installs it.
# Credits: Pete LePage (@petele).
pushd .
BASEDIR=https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac
mkdir ~/ChromiumTemp/
cd ~/ChromiumTemp/
@tomayac
tomayac / resize.sh
Created June 19, 2020 14:19
Resize script for web.dev images
#!/bin/sh
set -e
maxwidth="1600" # in pixels, the widest image you want to allow.
#find all .png in current dir and subdirectories
FILES="$(find . -iname '*.png')"
for imagefile in $FILES
do
@tomayac
tomayac / remoteStorage_adWordsScripts.js
Last active October 29, 2019 12:37
Remote Storage for AdWords Scripts
/**
* @author Thomas Steiner (tomac@google.com)
* @license CC0 1.0 Universal (CC0 1.0)
*
* Provides a simple key-value storage API modeled closely after
* the localStorage API in Web browsers, but tailored to AdWords Scripts.
* AdWords Scripts, due to execution time limits published at
* https://developers.google.com/adwords/scripts/docs/limits,
* forces users to store the state of a given script using either labels
* (https://developers.google.com/adwords/scripts/docs/tips#labels), or
* {
box-sizing: border-box;
padding: 0;
margin: 0
}
html {
font-size: 20px
}
// From https://developer.bluetooth.org/gatt/services/Pages/ServicesHome.aspx
var services = [
'alert_notification',
'automation_io',
'battery_service',
'blood_pressure',
'body_composition',
'bond_management',
'continuous_glucose_monitoring',
'current_time',
{
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36",
"lighthouseVersion": "2.5.0",
"generatedTime": "2017-11-01T11:30:50.138Z",
"initialUrl": "http://www.google.com/",
"url": "https://www.google.com/?gws_rd=ssl",
"audits": {
"is-on-https": {
"score": false,
"displayValue": "1 insecure request found",
@tomayac
tomayac / doodle.js
Last active December 12, 2016 15:36
Doodle Bookmarklet Wizard for Weekly Recurring Events
javascript: (() => {
// Whenever you run the bookmarklet, always returns the next Wednesday.
const nextWednesday = () => {
let ret = new Date();
ret.setDate(ret.getDate() + (3 - 1 - ret.getDay() + 7) % 7 + 1);
return ret.toLocaleDateString('en-US', {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'