Skip to content

Instantly share code, notes, and snippets.

@SunboX
SunboX / README.md
Created September 18, 2020 07:19 — forked from manuelbl/README.md
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
@SunboX
SunboX / gist:4079cda2ec490ac79f05dcc8eef56d82
Created March 28, 2018 06:40 — forked from kevinhooke/gist:d2eabbd402741ae728ef6ab2985dfddd
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:
@SunboX
SunboX / corporate-linux-desktop-howto.md
Created January 15, 2018 14:09 — forked from jtyr/corporate-linux-desktop-howto.md
How to run Linux desktop in a corporate environment

How to run Linux desktop in a corporate environment

DISCLAIMER

Some of the practices described in this HOWTO are considered to be illegal as they often break internal corporate policies. Anything you do, you do at your own risk.

@SunboX
SunboX / enpointExample.groovy
Created January 5, 2018 21:28 — forked from aurman/enpointExample.groovy
SmartThings API Endpoint Example
/**
* App Endpoint API Access Example
*
* Author: SmartThings
*/
preferences {
section("Allow Endpoint to Control These Things...") {
input "switches", "capability.switch", title: "Which Switches?", multiple: true
input "locks", "capability.lock", title: "Which Locks?", multiple: true
@SunboX
SunboX / exampleOauth.php
Created January 5, 2018 21:28 — forked from aurman/exampleOauth.php
SmartThings .php example authenticating and controlling SmartThings API endpoints
<?php
//client id and client secret
$client = '';
$secret = '';
//hardcode the full url to redirect to this file
$url = "";
//STEP 1 - Get Access Code
@SunboX
SunboX / gist:3ad98781eab0e9d34585ec01d96994ec
Created November 19, 2017 20:11 — forked from bruth/gist:2865951
Backbone Sync Queue
# Reference Backbone ajax function
_ajax = Backbone.ajax
requestQueue = []
requestPending = false
sendRequest = (options, promise, trigger=true) ->
options = _.clone options
if trigger
requestPending = true
@SunboX
SunboX / basic-http-auth-node.js
Last active May 1, 2023 19:02 — forked from cojohn/basic-http-auth-node.js
Basic HTTP Authorization Header in Node.js
var key = <my key>,
secret = <my secret>,
https = require("https"),
https_options = {
"host": <host>,
"path": <path>,
"port": <port>,
"method": <method>,
"headers": {
"Authorization": "Basic " + new Buffer(key + ":" + secret, "utf8").toString("base64")
@SunboX
SunboX / README.md
Last active August 29, 2015 14:24 — forked from hawkrives/README.md

from http://tips.naivist.net/2006/02/02/word_to_markdown_converter/ Word to Markdown converter

Some smart people who didn’t want to teach users how to code in HTML invented Textile markup language

Someone more lazy invented MarkDown syntax which is much easier to learn. MarkDown is really nice for small content management systems, blogging engines etc.

For instance, to mark text as bold, you write the “bold text” like “bold text”. Other rules can be found in the syntax page.

However, when you have a MS Word document with several pages of bolds, italics and lists, you don’t really want to re-code all the markup.

/*
YOU'LL BE ABLE TO PERFORM A CROSS DOMAIN REQUEST IF YOUR APP IS CERTIFIED OR PRIVILEDGED.
FOR MORE INFO CHECK THE PERMISSIONS MATRIX: https://docs.google.com/spreadsheet/ccc?key=0Akyz_Bqjgf5pdENVekxYRjBTX0dCXzItMnRyUU1RQ0E#gid=0
First you'll need to setup the permission for doing the cross domain request on your application manifest.
Go to your app manifest, to the permissions section and add the following:
"systemXHR": {}
@SunboX
SunboX / ibeacon.js
Last active August 29, 2015 14:21 — forked from janjongboom/ibeacon.js
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(() => {