Skip to content

Instantly share code, notes, and snippets.

View themasch's full-sized avatar

Mark Schmale themasch

View GitHub Profile
@themasch
themasch / doc.md
Last active October 31, 2023 05:41
unofficial docs of the LoL Spectator API

REST Service for LoL spectators

This is an unofficial, uncomplete and (pretty sure) wrong documentation of the RESTful service which powers the League of Legends spectator mode.

This documentation is desgined to be community driven and should be extended by everyone. If you find things missing, add them please!

How it works

Riot's spectator mode works by requesting replay data via HTTP form a service. The data is split in chunks which usually contain about 30 seconds of gameplay. Additionally there are key frames which seem to contain more information then a single chunk. They seem to be used to support

@themasch
themasch / mix.js
Created November 6, 2011 16:52
a tiny javascript "colorpicker". use it as a bookmarklet
(function() {
document.cE = document.createElement;
var s = [], div = document.cE('div');
var text = document.cE('input');
var col = [0, 0, 0];
var aE = "attachEvent", oc = "onchange", ok = "onkeyup";
var uB = function() {
var c = text.value.match(/\w\w?/g), n, i;
for(i in c) {
s[i].value = col[i] = parseInt(c[i], 16) || 0;
proxy_cache_path /var/cache/nginx/npm_cache levels=1:2 keys_zone=npm_cache:10m;
upstream npm_registry {
server registry.npmjs.org:443;
}
server {
listen 80;
server_name blblabla;
@themasch
themasch / amdshim.js
Last active September 18, 2018 08:58
UI5 AMD shim?
function define (req, factory) {
if (typeof req === 'function') {
factory = req
req = []
}
return sap.ui.define(req, factory, true)
}
define.amd = true
<?php
$array_a = [ 'a' => 'red', '42', true];
$array_b = [ 'blue', 42, 'true'];
var_dump(array_intersect($array_a, $array_b)); // [ '42' ]
var_dump(array_filter($array_a, function($v) use ($array_b) {
return(in_array($v, $array_b));
})); // [ '42', true ]
@themasch
themasch / example.js
Created May 8, 2018 16:14
example that creates a incorrect warning in webstorm/phpstorm
define(['./Object'], function (BaseObject) {
"use strict";
/**
* @class some cool class
*
* @abstract
* @public
* @alias demo.AbstractClass
*/
#!/usr/bin/env bash
set -Eeuo pipefail
function setup_pgpass_file {
echo -n "" > ~/.pgpass
chmod 600 ~/.pgpass
}
function backup_database {
@themasch
themasch / local_db.sh
Created April 19, 2018 09:43
start & stop a local dynamodb for fun and profit
#!/usr/bin/env bash
set -e
function install_dynamodb_local {
if [ ! -e "db/DynamoDBLocal.jar" ]; then
echo "Downloading DynamoDBLocal"
mkdir -p db && cd db
curl "https://s3.eu-central-1.amazonaws.com/dynamodb-local-frankfurt/dynamodb_local_latest.tar.gz" -s | tar -xz
cd ..
error[E0277]: the trait bound `errors::Error: storage::_IMPL_DESERIALIZE_FOR_User::_serde::export::From<std::sync::PoisonError<std::sync::MutexGuard<'_, rocksdb::DB>>>` is not satisfied
--> src/storage.rs:28:15
|
28 | match self.db.lock()?.get(format!("user:{}", username).as_bytes()) {
| ^^^^^^^^^^^^^^^ the trait `storage::_IMPL_DESERIALIZE_FOR_User::_serde::export::From<std::sync::PoisonError<std::sync::MutexGuard<'_, rocksdb::DB>>>` is not implemented for `errors::Error`
|
= help: the following implementations were found:
<errors::Error as storage::_IMPL_DESERIALIZE_FOR_User::_serde::export::From<std::num::ParseIntError>>
<errors::Error as storage::_IMPL_DESERIALIZE_FOR_User::_serde::export::From<std::io::Error>>
<errors::Error as storage::_IMPL_DESERIALIZE_FOR_User::_serde::export::From<chrono::ParseError>>
#!/bin/bash
declare -A deployTo
deployTo[development]="/home/masch/gitdeploy/dev"
deployTo[master]="/home/masch/gitdeploy/prod"
gitDir="/home/masch/gitdeploy/deploy.git"
function deploy() {
branch=$1