Skip to content

Instantly share code, notes, and snippets.

@manuelbl
manuelbl / README.md
Created August 3, 2019 09:12
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
@kevinhooke
kevinhooke / gist:d2eabbd402741ae728ef6ab2985dfddd
Last active January 31, 2020 23:37
Using Docker on Windows with Cisco AnyConnect VPN in non-split tunnel mode
Start docker before connecting vpn (to get local ip, eg 192.168.99.100)
After start, connect to VPN, then follow next steps:
From: https://github.com/boot2docker/boot2docker/issues/628
Add port forwarding to the NAT'd adapter in VirtualBox, add:
docker: host=127.0.0.1 port=2367 guest ip=[blank] guest port=2376
container port: 127.0.0.1, port=[the container exposed port to forward] guest ip=[blank], guest port[container port]
From https://www.iancollington.com/docker-and-cisco-anyconnect-vpn/
In Docker Quickstart Terminal, to point to port forwarded Docker, and to turn off checking of SSL certs:
@pc035860
pc035860 / version_compare.js
Created October 12, 2015 09:10 — forked from TheDistantSea/version_compare.js
Function to compare two version strings (e.g. "1.6.1" is smaller than "1.7"). Developed in order to answer http://stackoverflow.com/a/6832721/50079.
/**
* Compares two software version numbers (e.g. "1.7.1" or "1.2b").
*
* This function was born in http://stackoverflow.com/a/6832721.
*
* @param {string} v1 The first version to be compared.
* @param {string} v2 The second version to be compared.
* @param {object} [options] Optional flags that affect comparison behavior:
* <ul>
* <li>
@stasm
stasm / abstract.md
Last active August 29, 2015 14:24
New syntax for L20n

New Syntax Proposal for L20n

Goals & Means:

  • Make the most commonly used syntax easy on the eyes by reducing the number of characters used.

@janjongboom
janjongboom / ibeacon.js
Created May 18, 2015 12:42
iBeacon scanning Firefox OS
navigator.mozBluetooth.defaultAdapter.startLeScan([]).then(handle => {
console.log('Start scanning', handle);
handle.ondevicefound = e=> {
var record = parseScanRecord(e.scanRecord);
if (record) {
console.log('Found an iBeacon', record.uuid, record.major, record.minor, e.rssi);
}
}
setTimeout(() => {
@janjongboom
janjongboom / gist:94d575526a689687a6b8
Last active February 24, 2023 14:40
Firefox OS / JanOS on Raspberry Pi with GPIO support

This does NOT work on Raspberry Pi 2!

  1. Obtain a 8GB (or bigger) SD Card
  2. Download disk image from http://janos.io/builds/fxos-pi-gpio.img.zip and unzip
  3. Put SD card in your computer
  4. Find out where your SD card is mounted (BE REALLY SURE ITS THE RIGHT DEVICE, IT WILL BE WIPED COMPLETELY!!!), f.e. /dev/disk5 on OSX
  5. On Linux, run: sudo dd bs=4M if=fxos-pi-gpio.img of=/path/to/your/disk
  6. On OSX, run: sudo dd bs=4m if=fxos-pi-gpio.img of=/dev/rdisk5 (do rdisk, not disk here!)
  7. When it's done put it in your Pi and start up
  8. The demo's are wired like this: yellow LED on GPIO2, red LED on GPIO3, button (wire it as pulldown) on GPIO26.
@janjongboom
janjongboom / gist:8faddcbfc361acab4ec4
Created February 23, 2015 12:02
Flash Jan's experimental build for rpi
  1. Follow instructions to install the prebuilt version for rpi from here: https://wiki.mozilla.org/Hacking_b2g_on_Raspberry_Pi
  2. Boot rpi and connect to wired network. Find the IP it's registered via nmap --open -p 5555 192.168.2.*
  3. Connect over adb: (f.e.) adb connect 192.168.2.100
  4. Checkout jan-os/gecko-dev, rpi branch; and use it as your GECKO_PATH
  5. Think this only works on Ubuntu by the way, but:
  6. In B2G, ./config.sh rpi && ./build.sh gecko && ./flash.sh gecko
  7. Checkout jan-os/janos, gpio branch
  8. Run make reset-phone
  9. adb logcat to see if flashing succeeded
@flamingspaz
flamingspaz / .userconfig
Created January 16, 2015 14:50
nexus-4-kk
export MOZILLA_OFFICIAL=1
export PRODUCTION=1
export CC=clang
export CXX=clang++
export REMOTE_DEBUGGER=1
export GAIA_DEV_PIXELS_PER_PX=2
export DOGFOOD=0
# multilocale stuff, need to clone the locales into B2G/gaia/locales
export LOCALE_BASEDIR=$PWD/gaia/locales
export LOCALES_FILE=$PWD/gaia/locales/languages-dev.json
@nikcorg
nikcorg / berlin-jsconf-2014.md
Last active August 4, 2023 12:45
Slide decks of JSConf 2014
@codito
codito / PhoneUnitTestsInTfs.md
Last active August 29, 2015 14:03
Running Windows Phone unit tests in team build (TFS)

Running Windows Phone unit tests in team build (TFS)

Prerequisites:

  • Build Agent needs to run a physical x64 Windows 8.1 based machine to be able to run Phone emulators
  • Setup build agent to run as an interactive process and enable it to run unit tests (obtain developer license). Check this MSDN page for more help on this.
  • Install Visual Studio 2013 + Update 2 (with support for Phone development) on Build Agent

Once you have these, you can use custom scripts in TFS 2013 build definition to run phone tests using vstest.console command line. See the script RunPhoneTests.bat