This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Custom Post Types Example | |
* Description: An example plugin to create custom post types with custom taxonomies and custom meta fields, including exposing to the REST API. | |
* Plugin URI: http://kosso.co.uk | |
* Version: 1.0.0 | |
* Author: Kosso | |
* Author URI: http://kosso.co.uk | |
* License: GPLv2 | |
* Network: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
const SUBGRAPH_ETH_BLOCKS = 'https://api.thegraph.com/subgraphs/name/blocklytics/ethereum-blocks'; | |
// Run: `node getBlockFromtimeStamp.js` to see the block number at the given date. | |
const date = 'Fri Dec 24 2021 10:22:12 GMT'; // The date you want to get the block number from. | |
const timestamp = Math.round(new Date(date).getTime() / 1000); // Unix timestamp in seconds | |
getBlockFromTimestamp(timestamp).then(block => { | |
// result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
const API_KEY = 'SOME_KEY'; | |
/** | |
* Use HTML5 Canvas to get the image data | |
* @param {HTMLImageElement} img An Image Tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use the websocket-relay to serve a raw MPEG-TS over WebSockets. You can use | |
// ffmpeg to feed the relay. ffmpeg -> websocket-relay -> browser | |
// Example: | |
// node websocket-relay yoursecret 8081 8082 | |
// ffmpeg -i <some input> -f mpegts https://localhost:8081/yoursecret | |
var fs = require('fs'), | |
https = require('https'), | |
WebSocket = require('ws'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
via http://stackoverflow.com/questions/4998908/convert-data-uri-to-file-then-append-to-formdata/5100158 | |
via http://www.smartjava.org/content/face-detection-using-html5-javascript-webrtc-websockets-jetty-and-javacvopencv | |
**/ | |
function dataURItoBlob(dataURI) { | |
var binary = atob(dataURI.split(',')[1]); | |
var array = []; | |
for(var i = 0; i < binary.length; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -i INPUT.mp4 -vf scale=-1:720 -c:v libx264 -crf 18 -preset veryslow -c:a copy OUTPUT.mp4 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//opcache_reset(); // Disable local dev MAMP cache | |
/* | |
WP_API_OAuth_Test_client.php | |
Tested with Wordpress 4.7.1 | |
WordPress REST API - OAuth 1.0a Server v.0.3.0 - https://en-gb.wordpress.org/plugins/rest-api-oauth1/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Setting up ElasticSearch 7.4.0 on Raspberry Pi 4 | |
================================================ | |
sudo apt-get install default-jre | |
sudo nano /etc/profile | |
export JAVA_HOME=/usr/lib/jvm/default-java export PATH=$JAVA_HOME/bin:$PATH | |
sudo reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Proxy script for Shoutcast audio streams. | |
// Overcomes the CORS issue when using JavaScript to fetch streams for playback and analysis. | |
// Also http > https | |
/* | |
// .htaccess file | |
// eg: index.php and .htaccess in /radio on your host. | |
// Point JS/fetch to https://yourhost/radio/audio.mp3 (or any made-up .mp3 name) |
NewerOlder