Skip to content

Instantly share code, notes, and snippets.

@clemos
clemos / index.html
Last active July 4, 2021 12:10
raspberry bluetooth setup
<html>
<head>
<style>
#log {
display:block;
width: 100%;
height: 200px;
}
</style>
</head>
@clemos
clemos / AoC2.js
Last active December 9, 2020 08:37
AoC 2020
fetch("https://adventofcode.com/2020/day/1/input").then(res => res.text()).then(text => text.split("\n").map(v => parseInt(v))).then(values => {
for(let i=0; i<values.length; i++) {
const v1 = values[i]
for(let j=i+1; j<values.length; j++) {
const v2 = values[j]
for(let l=j+1; l<values.length; l++) {
const v3 = values[l]
if( v1+v2+v3 === 2020) {
return v1*v2*v3
}
@clemos
clemos / input.py
Created August 1, 2020 11:58
scripts for Odroid Go Advance
#!/bin/python3
"""
sets F6 + vertical pad to set volume, F6 + horizontal pad to set brightness
"""
import evdev
import subprocess
BRIGHTNESS_PATH = "/sys/class/backlight/backlight/brightness"
@clemos
clemos / notes.txt
Last active April 27, 2019 16:50
raspberry pi settings
https://www.hackster.io/112938/kuman-tft-3-5-retropie-2018-a9b0c8
dtoverlay=tft35a,rotate=270,fps=50,speed=31230000
https://github.com/goodtft/LCD-show/issues/34
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
@clemos
clemos / App.jsx
Last active August 27, 2018 15:06
simple parent/children management
class Parent extends React.Component {
state = {
currentCell: null,
cells: []
};
onOpenCell = (cell) => {
this.setState({
currentCell: cell,
@clemos
clemos / index.html
Last active August 24, 2017 15:08
three.js rollercoaster + webcam texture
<!DOCTYPE html>
<html lang="en">
<head>
<title>three.js webvr - roller coaster</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<!-- Origin Trial Token, feature = WebVR (For Chrome M59+), origin = https://threejs.org, expires = 2017-09-03 -->
<meta http-equiv="origin-trial" data-feature="WebVR (For Chrome M59+)" data-expires="2017-09-03" content="Aqj+6XPnxHoSxQj/CDjGXhzrVFeP12/Pgvj7rfqFqVzodYX0ZXJNHTJIvCVExQfvip+Zq9GES+SOQ/zJlpceZgcAAABNeyJvcmlnaW4iOiJodHRwczovL3RocmVlanMub3JnOjQ0MyIsImZlYXR1cmUiOiJXZWJWUjEuMSIsImV4cGlyeSI6MTUwNDQ2NDIwNn0=">
<style>
body {
@clemos
clemos / client.js
Last active November 7, 2021 00:29
quick and dirty nodejs webrtc server
var pc = new RTCPeerConnection();
var localVideo = document.getElementById('local');
var remoteVideo = document.getElementById('remote');
var isBroadcaster = document.location.hash.indexOf('broadcast') > -1;
var watcherId;
function broadcast(stream) {
localVideo.src = URL.createObjectURL(stream);
pc.addStream(stream);
@clemos
clemos / app.js
Created January 13, 2017 17:07
test web file
window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem;
var opts = {
type: window.PERSISTENT,
size: 1024*1024
};
function FileView(ul) {
var files = [];
@clemos
clemos / Test.hx
Created October 6, 2015 11:58
Haxe/PHP bits issue
import haxe.Int32;
class Test {
static function main() {
// taken from https://github.com/HaxeFoundation/haxe/blob/development/tests/unit/src/unit/issues/Issue3414.hx.disabled
var x = 200015;
trace((((x << 28)) >> 28));
trace(((x << 28) & 0xffffffff) >> 28);
var x32 : Int32 = 200015;
@clemos
clemos / Dockerfile
Last active March 16, 2018 08:36
Dockerfile for Scala play
FROM ubuntu:latest
MAINTAINER Ingensi labs <contact@ingensi.com>
RUN apt-get update
RUN apt-get -y upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install mysql-server curl software-properties-common unzip
RUN echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections
RUN echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections
RUN DEBIAN_FRONTEND=noninteractive apt-add-repository -y ppa:webupd8team/java