Skip to content

Instantly share code, notes, and snippets.

@t2psyto
t2psyto / brython_video_chromakey_test.html
Created January 16, 2018 08:42
brython video chromakey test
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>video &amp; canvas example</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.4.0/brython.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.4.0/brython_stdlib.js"></script>
</head>
@t2psyto
t2psyto / brython_video_canvas_example.html
Created January 11, 2018 08:36
Brython video & canvas example
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>video &amp; canvas example</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.4.0/brython.min.js"></script>
</head>
<body onload="brython()">
<h1>Brython video &amp; canvas example</h1>
@t2psyto
t2psyto / p5js_test.html
Last active December 27, 2020 18:49 — forked from jeremy886/p5js_test.html
Brython p5.js test
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.11/p5.min.js"></script>
<script type="text/javascript"
src="https://cdn.rawgit.com/brython-dev/brython/master/www/src/brython.js">
</script>
<script src="https://cdn.rawgit.com/brython-dev/brython/master/www/src/brython_stdlib.js"></script>
</head>
<body onload="brython(1)">
@t2psyto
t2psyto / brython_webcam.html
Created January 1, 2018 07:01
Brython webcam example
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Camera with mediaDevice</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.4.0/brython.min.js"></script>
</head>
<body onload="brython()">
<h1>Brython webcam example</h1>
@t2psyto
t2psyto / webcam.py
Created January 1, 2018 06:35
Brython webcam example
import browser
from browser import html, document
aa = document['main']
videotag = html.VIDEO(id='video', width='320', height='240')
aa.html = ""
aa <= videotag
from javascript import JSObject
This file has been truncated, but you can view the full file.
// brython.js brython.info
// version [3, 3, 0, 'alpha', 0]
// implementation [3, 3, 5, 'dev', 0]
// version compiled from commented, indented source files at
// github.com/brython-dev/brython
!function(r,n){"use strict";function t(r,n,t,e){for(t=void 0!==t?t:0,e=void 0!==e?e:r.length;e>t;){var c=e+t>>1;r[c]>n?e=c:t=c+1}return t}function e(r){if(35>r)return r;var n=t(K,r);return L[n]}function c(r){var n=t(M,r);return N[n]}function u(r){switch(r.charCodeAt(0)){case 9:case 10:case 11:case 12:case 13:case 28:case 29:case 30:case 31:case 32:case 133:case 160:case 5760:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8232:case 8233:case 8239:case 8287:case 12288:return!0}return!1}function a(r){var n;return r>=1114112?n=0:(n=e(r>>J),n=c((n<<J)+(r&(1<<J)-1))),y[n]}function i(r,n){for(var t="",e=0;n>e;e++)t+=String.fromCharCode(I[r+e]);return t}function o(r){var n=r.charCodeAt(0),t=a(n);return 0!=(t[H]&T)}function f(r){var n=r.charCodeAt(0),t=a(n);retu
from browser import document, window, html
try:
document["main"]
except(KeyError):
document["add_main"].click()
element = document["main"]
element.style.width = "800px"
@t2psyto
t2psyto / pbnotify.sh
Created August 25, 2017 01:27
pushbullet api push using wget
#!/bin/bash
PB_TOKEN=your_pushbullet_api_key
PB_TITLE=title
PB_BODY=body
wget -q -O - --header 'Access-Token: $PB_TOKEN' --header="Content-Type: application/json" https://api.pushbullet.com/v2/pushes \
--post-data="{\"type\": \"note\", \"title\": \"${PB_TITLE}\", \"body\": \"${PB_BODY}\"}" > /dev/null 2&>1
@t2psyto
t2psyto / gist:f5453707d2658173715f49293d096fe5
Created July 14, 2017 04:15
powershell oneliner for encode/decode base64 to file
# encode from binary file to base64txt
powershell -C "& {$outpath = (Join-Path (pwd) 'out_base64.txt'); $inpath = (Join-Path (pwd) 'data.jpg'); [IO.File]::WriteAllText($outpath, ([convert]::ToBase64String(([IO.File]::ReadAllBytes($inpath)))))}"
# decode from base64txt to binary file
powershell -C "& {$outpath = (Join-Path (pwd) 'outdata2.jpg'); $inpath = (Join-Path (pwd) 'out_base64.txt'); [IO.File]::WriteAllBytes($outpath, ([convert]::FromBase64String(([IO.File]::ReadAllText($inpath)))))}"
@t2psyto
t2psyto / check_nasne.sh
Last active December 26, 2017 02:42
NASNE の録画状態をチェック時と比較してstart/stopが変化したら通知を投げる。
#!/bin/bash
PATH=/root/bin:$PATH
## for linux
#nowId_now=`curl -s "http://192.168.1.153:64210/status/boxStatusListGet" | jq -r ".tvTimerInfoStatus.nowId"`
#schedule=`curl -s "http://192.168.1.153:64220/schedule/reservedListGet?searchCriteria=0&filter=0&startingIndex=0&requestedCount=0&sortCriteria=1"`
## for openwrt
nowId_now=`wget -q -O - "http://192.168.1.153:64210/status/boxStatusListGet" | JSON.sh -l | sed "s/\"//g" | grep -F '[tvTimerInfoStatus,nowId]' | cut -f2`
schedule=`wget -q -O - "http://192.168.1.153:64220/schedule/reservedListGet?searchCriteria=0&filter=0&startingIndex=0&requestedCount=0&sortCriteria=1"`