Skip to content

Instantly share code, notes, and snippets.

View m1m1s1ku's full-sized avatar
🌀

Léonard. m1m1s1ku

🌀
View GitHub Profile
@m1m1s1ku
m1m1s1ku / konamiRx.js
Created February 10, 2018 10:10
Konami code using rx
Rx.Observable.fromEvent(document.body, 'keyup')
.map((event) => event.keyCode)
.bufferCount(7)
.subscribe((buffer) => {
const keymap = [ 77,73,82,65,78,68,65 ];
const cond = buffer.every((v,i)=> v === keymap[i])
if(cond){
const dialog = this.shadowRoot.querySelector('#debug');
dialog.open();
@m1m1s1ku
m1m1s1ku / shairport-sync-rpi.md
Last active April 29, 2018 01:25
Shairport-sync on Raspberry Pi

Shairport-sync on RPI

Shairport-sync allow to use the Raspberry Pi (Model A, B) as an AirPlay Audio gateway.

It's a wonderful option to add AirPlay on an old amplifier for example !

  • Install Raspbian latest on a SD Card
  • Boot
  • sudo raspi-config
    • Next > Localisation + Wi-Fi + SSH (if needed)
@m1m1s1ku
m1m1s1ku / filler.ts
Last active May 23, 2018 19:25
flatten form fields hummus (formFiller new gen)
// tslint:disable:interface-name
import * as hummus from 'hummus';
import * as fs from 'fs';
import * as path from 'path';
import logger from '../helper/logger';
import * as util from 'util';
const writeFile = util.promisify(fs.writeFile);
const unlink = util.promisify(fs.unlink);
@m1m1s1ku
m1m1s1ku / konami.ts
Last active June 10, 2018 22:06
Konami RXJS 6
let keyDowns$: Observable<Event | string> = fromEvent(document, 'keyup');
keyDowns$ = keyDowns$.pipe(
map((event: KeyboardEvent) => event.code),
bufferCount(10, 1),
map(codes => codes.join(',')),
filter(codes => codes === "ArrowUp,ArrowUp,ArrowDown,ArrowDown,ArrowLeft,ArrowRight,ArrowLeft,ArrowRight,KeyB,KeyQ")
)
keyDowns$.subscribe(() => {
this.setState({admin: !this.state.admin, item: null});
@m1m1s1ku
m1m1s1ku / bbmedia.js
Created November 24, 2018 08:13
bbmedia
// BB [media] v1.69 [2016-05-22] (C) 2014 Evgeny Vrublevsky, http://phpbbex.com/
// Licensed under CC BY-NC-ND, http://creativecommons.org/licenses/by-nc-nd/3.0/
(function(k,m,b){var a="media";var c="audio";var r="video";if(k.bbmediajs!==b){return}bbmediajs=true;var l=function(t,e,s){if(data=t.match(new RegExp("[?&]"+e+"=([^?&#]*)",""))){return decodeURIComponent(data[1])}else{return(s===b)?null:s}};var n=function(t,v,e,s){s=jQuery.extend({frameborder:"0"},s);var u='<iframe style="vertical-align: bottom; width: '+v+"px; height: "+e+'px;" width="'+v+'" height="'+e+'" src="'+t+'" webkitallowfullscreen mozallowfullscreen allowfullscreen';jQuery.each(s,function(w,x){u+=" "+w+'="'+x+'"'});return u+"></iframe>"};var h=function(u,w,e,t){t=jQuery.extend({allowscriptaccess:"never",allowfullscreen:"true",ignorewheel:false},t);var v=' width="'+w+'" height="'+e+'"'+(t.ignorewheel?' ignorewheel="1"':"");var x='<object style="vertical-align: bottom;" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+v+'><param name="m
@m1m1s1ku
m1m1s1ku / grid.js
Created January 26, 2019 23:19
The grid polymer3
import * as Polymer from '@polymer/polymer';
import * as Settings from '@polymer/polymer/lib/utils/settings';
import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
export default class TheGrid extends GestureEventListeners(Polymer.PolymerElement) {
static get is() { return 'the-grid'; }
static get template(){
return Polymer.html`
@m1m1s1ku
m1m1s1ku / debounceTimeJustWhy.ts
Created April 26, 2019 17:40
DebounceTime(0) is BAD
// Write any JavaScript you want, just make sure that
// the last expression is an Rx.Observable
const { asapScheduler, animationFrameScheduler, asyncScheduler, queueScheduler, merge, EMPTY } = Rx;
const { map, debounceTime, startWith, filter } = RxOperators;
// New macro-task (long-running task)
const asyncScheduler$ = EMPTY.pipe(
startWith('async', asyncScheduler)
)
This file has been truncated, but you can view the full file.
#!/bin/bash
# This script was initially based on the information documented on the following sites:
# https://help.ubuntu.com/community/LiveCDCustomization (shared under a Creative Commons Attribution-ShareAlike 3.0 License available at https://help.ubuntu.com/community/License)
# https://wiki.ubuntu.com/KernelTeam/GitKernelBuild (shared under a Creative Commons Attribution-ShareAlike 3.0 License available at https://help.ubuntu.com/community/License)
# and then further developed by Linuxium ([email protected]).
# Version 1: This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
# Version 2.01.050417: This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 License.
# Version 3.01.120417: This work is licensed under GNU GPL version 3 under one-way compatibility with CC BY-SA 4.0.
# Version 3.02.130417, 4.06.220417 to 4.09.280417, 5.01.020517, 6.01.120517, 6.02.0 to 6.03.3, 7.1.0 to 7.3.5.1, 7.3.6, 8.0.0 to 8.2.7: This work is licensed under GNU GPL version
@m1m1s1ku
m1m1s1ku / FixAudioChromiumOS.md
Last active August 4, 2019 22:18
Debug audio on ChromiumOS (or Generic linux tablet)

Fix broken audio on ChromiumOS

Fix commands :

  • Ctrl + Alt + T

  • shell

  • cras Check output if any errors, you are good to find config files.

  • If something is missing, go on https://github.com/plbossart/UCM to find missing files (or elsewhere.)

  • Boot under Ubuntu or another live usb to put files at the correct place

@m1m1s1ku
m1m1s1ku / widevine.md
Last active August 5, 2019 20:36
Widevine (Netflix...) on ChromiumOS