Skip to content

Instantly share code, notes, and snippets.

@kartben
kartben / misc
Last active September 21, 2023 13:22
lorem ipsum
Finished [Fuzzing]
Finished [CII-Best-Practices]
Finished [Dangerous-Workflow]
Finished [Token-Permissions]
Finished [CI-Tests]
Finished [SAST]
Finished [Pinned-Dependencies]
Finished [Vulnerabilities]
Finished [Code-Review]
Finished [Branch-Protection]
@subscription-key = REPLACE_WITH_YOUR_AZURE_MAPS_KEY
@SeattleWA = 47.60323,-122.33028
@RedmondWA = 47.67491,-122.124
###
# GetTimezoneByCoordinates for Seattle WA
###
GET https://atlas.microsoft.com/timezone/byCoordinates/json?subscription-key={{subscription-key}}&api-version=1.0&options=all&query={{SeattleWA}}
###
@kartben
kartben / gist:350a9b72374e44c8ab60abaaef7c1acd
Last active July 4, 2019 15:00
list of famous paintings + thumbnails
SELECT ?item ?itemLabel ?thumb ?catcode WHERE { ?item p:P528 [ pq:P972 wd:Q41634361 ; ps:P528 ?catcode].
?item wdt:P18 ?picture .
BIND(REPLACE(wikibase:decodeUri(STR(?picture)), "http://commons.wikimedia.org/wiki/Special:FilePath/", "") as ?fileName) .
BIND(REPLACE(?fileName, " ", "_") as ?safeFileName)
BIND(MD5(?safeFileName) as ?fileNameMD5) .
BIND(CONCAT("https://upload.wikimedia.org/wikipedia/commons/thumb/", SUBSTR(?fileNameMD5, 1, 1), "/", SUBSTR(?fileNameMD5, 1, 2), "/", ?safeFileName, "/650px-", ?safeFileName) as ?thumb)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY xsd:integer(?catcode)
find . -type d -depth 1 -exec sh -c "git --git-dir={}/.git --work-tree=$PWD/{} log --since '1 year ago' --until 'yesterday' --format='%aN' | sort -uf" \; | sort -uf
# 1 year ago
find . -type d -depth 1 -exec sh -c "git --git-dir={}/.git --work-tree=$PWD/{} log --since '2 years ago' --until '1 year ago' --format='%aN' | sort -uf" \; | sort -uf
@kartben
kartben / che.sh
Last active March 30, 2016 06:07
#!/bin/bash
sudo apt-get update
sudo apt-get -y install --no-install-recommends \
openssh-server \
sudo \
procps \
wget \
unzip \
@kartben
kartben / mqtt_spark_streaming.py
Last active June 10, 2024 17:16
Example of how to use Spark Streaming for MQTT data consolidation
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
var YouTube = require('../lib/youtube');
var config = require('./config');
var fs = require('fs');
var youTube = new YouTube();
youTube.setKey(config.key);
youTube.getPlayListsItemsById('PLy7t4z5SYNaQS1XZ8uiqqn0nNLi4qU-VW', function(error, result) {
var http = require('http'),
httpProxy = require('http-proxy'),
connect = require('connect');
//var morgan = require('morgan')
var proxy = httpProxy.createProxyServer({
target: 'http://localhost:8080' // openHAB/SmartHome URL
});
var app = connect();
#!/bin/bash
S3_LOG_LOCATION="s3://thelogbucket/logdir"
LOCAL_LOG_LOCATION="/tmp/log/"
REPORT_TITLE="My report title"
HTML_OUTPUT_DIR="/tmp/reporthtml"
REPORT="/tmp/report.ps"
# Sync log files to a local directory
s3cmd -v sync ${S3_LOG_LOCATION} ${LOCAL_LOG_LOCATION}