Skip to content

Instantly share code, notes, and snippets.

View kosso's full-sized avatar

Kosso kosso

View GitHub Profile
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <esp_heap_caps.h>
#include <esp_heap_trace.h>
BLECharacteristic *pCharacteristic;
bool deviceConnected = false;
@kosso
kosso / strip_tags.html
Created December 12, 2017 14:33
Extract text only from HTML
<html>
<head>
<script>
function strip_tags (str, allowed_tags) {
// via http://kevin.vanzonneveld.net
var key = '', allowed = false;
var matches = [];
..
processor = audio_context.createScriptProcessor(0, 1, 1);
processor.onaudioprocess = function (event) {
var array_left = event.inputBuffer.getChannelData(0);
var array_right = event.inputBuffer.getChannelData(1);
// ....
};
// Begin retrieving microphone data.
audio_context.microphone.connect(processor);
@kosso
kosso / angularjs_directive_attribute_explanation.md
Created September 21, 2017 15:12 — forked from CMCDragonkai/angularjs_directive_attribute_explanation.md
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>
@kosso
kosso / archiveboom.py
Last active September 17, 2017 21:00
A simple script to download all your Audioboom.com recordings, photos and metadata. version 0.1. Could eventually be extended upload to Archive.org .. or anywhere.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import json
import sys
# archiveboom.py : Downloads all Audioboom audio clips, associated photos and metadata..
# Eventually, it will also upload to Archive.org.
@kosso
kosso / environment.py
Last active August 19, 2017 21:03
Uses PiCamera to take a photo with a timestamped filename, then add some text with transparent 'underlays' and a logo. Will get the Temp and Humidity data via GPIO from the DHT22 sensor. Light via Enviro Phat and Moisture via analog input from TE-215 sensor to Enviro Phat analog pin 0. Also draws a circle filled with the colours detected by the …
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 'SENTREE'
# ----------------
# Uses PiCamera to take a photo with a timestamped filename,
# then add some text with transparent 'underlays' and a logo.
# Will get the Temp and Humidity data via GPIO from the DHT22 sensor.
# Light via Enviro Phat and Moisture via analog input from TE-215 sensor to Enviro Phat analog pin 0.
# Also draws a circle filled with the colours detected by the Enviro Phat
@kosso
kosso / API.php
Created August 6, 2017 17:41 — forked from mohamedsalehamin/API.php
Wp-Polls Rest Api Gist
<?php
/**********************************************************************
*
* Poll
*
**********************************************************************/
function get_poll_template_by_me($poll_id, $display_loading = true)
{
global $wpdb;
$data = array();
@kosso
kosso / gist:a513135384d5d78247f1af8464917a4c
Last active June 25, 2023 15:27
Instructions for setting up a Raspberry Pi Zero to send an iOS push notification when network interfaces go 'up'
###Sending Push notifications from Raspberry Pi when network interfaces go online.
- @kosso
- Apple : Set up app ID with Push Notifications cert.
- Download the .p12 CERT and KEY files
via: http://blog.raminrakhamimov.com/?p=81
Convert the p12 files to PEM format with:
@kosso
kosso / fb-post-preview.directive.js
Created June 8, 2017 02:30 — forked from thachnuida/fb-post-preview.directive.js
Angular directive to embed Facebook public post
(function () {
'use strict';
/**
* @desc Direictive to embed facebook post
* @example <fb-post-preview data-href="vm.postUrl"></fb-post-preview>
*/
angular
.module('fbDirective')
.directive('fbPostPreview', fbPostPreview);
@kosso
kosso / gist:82c9d0874f3135049190a2e6cd6ead51
Created May 23, 2017 23:20
Multiple WP REST API requests in a single HTTP request
<?php
/**
* Plugin Name: WP REST API Batch Requests
* Description: Enabled a multi / batch requests endpoint for the WP RES API
* Author: Joe Hoyle
* Version: 1.0-alpha1
* Plugin URI: https://github.com/WP-API/WP-API
* License: GPL2+
*/