Skip to content

Instantly share code, notes, and snippets.

@noerw
noerw / GeoTIFF_leafletwidget_generator.r
Last active May 17, 2016 07:42
R script to visualize GeoTIFFs in a Leaflet Map. Generates an HTML file containing this map
# dependencies on fedora23:
# gdal-devel geos-devel proj-devel proj-nad proj-epsg
library(htmlwidgets)
library(raster)
library(leaflet)
# PATHS TO INPUT / OUTPUT FILES
projectPath = "/home/kreis/git/geotiff/"
#imgPath = paste(projectPath,"data/cea.tif", sep = "")
@noerw
noerw / create_RGBInt_colorRamp.r
Last active December 3, 2015 10:09
create a color ramp, which assigns every RGBInt value it's true color
# i know, this is a really stupid hack, but "necessary" for
# this issue: https://github.com/rstudio/leaflet/issues/212
#' @describe creates a list of RGB values in ascending order,
#' with the blue channel beeing the least significant,
#' and the red channel beeing the most significant.
#' @param bitdepth The bitdepth of the values to create.
#' defaults to 8bit, and creates ~16kk values
#' @return a matrix containing the RGB values as integers.
rgbIntMatrix <- function(bitdepth = 8) {
@noerw
noerw / owncloud_backup.sh
Created September 9, 2016 19:42
automated owncloud upgrade (mysql)
#!/bin/bash
# create a backup of owncloud & upgrade to the latest version
# requires root. depends on mysqldump, wget, tar
# should run on any linux machine
#
# - disables all apps
# - performs a mysqldump
# - backups the current installation
# - gets the new archive & installs it
@noerw
noerw / mobile-osem_dbmigration.go
Last active January 24, 2017 16:05
migration script in go/mgo for the openSenseMap. adding support for mobile boxes
/*
TODO:
- mongo performance optimieren
- in db migration framework einbetten: https://github.com/mattes/migrate
- filter measurements to update by date
IDEAS zur optimierung
- multithreaded. 4 statt 1?
-> 3 packt mein laptop, 50% schneller
- indexes entfernen? https://docs.mongodb.com/v3.2/core/write-performance/ -> besserer write
@noerw
noerw / osemcurl.sh
Created May 23, 2017 08:36
curl commands for the opensensemap API. requires jq
#!/bin/bash
OSEM_API=https://api.osem.vo1d.space
#OSEM_API=http://localhost:8000
# register user
OSEM_TOKEN=$(curl -H "content-type: application/json" $OSEM_API/users/register -d '{"name":"firstname","email":"[email protected]","password":"12345678"}' | jq .token | tr -d '"')
# user login
OSEM_TOKEN=$(curl -H "content-type: application/json" $OSEM_API/users/sign-in -d '{"email":"[email protected]","password":"12345678"}' | jq .token | tr -d '"')
@noerw
noerw / ttn-decoder-lora-serialization-osem.js
Last active July 18, 2017 09:50
TTN payload function for lora-serialization -> openSenseMap.org JSON profile
function Decoder (bytes, port) {
'use strict';
let boxes = [];
// maps LoRa ports to openSenseMap configurations
// should contain
// [
// TEMPSENSOR_ID,
// HUMISENSOR_ID
@noerw
noerw / keybase.md
Created October 24, 2017 19:08
keybase.md

Keybase proof

I hereby claim:

  • I am noerw on github.
  • I am norwin (https://keybase.io/norwin) on keybase.
  • I have a public key ASAMx_UrJ8tm28iZ2aOGLr5PpqWnNChNJ4oUb84zdiIPAwo

To claim this, I am signing this object:

@noerw
noerw / dokuwiki_fetcher.sh
Created April 17, 2018 10:43
fetch all pages of a doku wiki install (given a filelisting)
#!/bin/bash
base=/var/www/intern/data/pages
doku='https://DOKUWIKIHOST/doku.php?id='
filelist=`find $base -type f -name '*.txt'`
echo -e "gonna fetch `wc -w <<< $filelist` pages!11!!\n"
for file in $filelist; do
@noerw
noerw / READM.md
Created August 31, 2018 11:04
Kibana 6.4 read only access

Kibana 6.4 read only access

warning: this list of endpoints was discovered empirically

in case you want to restrict Kibana access to read only, whitelist the following endpoints:

  • GET /app/kibana
  • GET /bundles/*
  • GET /plugins/*
  • GET /api/saved_objects/_find
@noerw
noerw / shader-to-wallpaper.sh
Created October 14, 2018 23:06
convert GLSL shader to gnome wallpaper slideshow
#!/usr/bin/env bash
shader=$1 # first argument is path to shader
renderstart=0 # seconds
renderend=20
resolutionx=1920
resolutiony=1080
wallduration=20 # seconds, minimum 1