Skip to content

Instantly share code, notes, and snippets.

View tobsn's full-sized avatar

Tobsn tobsn

  • US/EU/SEA
View GitHub Profile
@marcusraitner
marcusraitner / covid-19-7-day-incidence-county.js
Last active June 6, 2023 18:12 — forked from MatzeKitt/covid-19-chart-county.js
Script for ScriptableApp displaying the 7-Day-Incidence in your county in Germany
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-gray; icon-glyph: magic;
// Licence: GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007
// Author: Marcus Raitner (https://fuehrung-erfahren.de)
// Source: https://github.com/marcusraitner/COVID-19-Dashboard
// ## Changelog
// * 1.0.1: Correction of layout of label for covid-beds
// * 1.0.2: Bug-Fix for Saar-Pfalz-Kreis (using GEN instead of county for join)
// * 1.0.3: Bug-Fix for Landsberg a. Lech (now using both GEN and county)
@amrav
amrav / LocalSettings.php
Created June 20, 2017 01:56
Slack integration using Redis
# Slack integration
require_once "$IP/extensions/Slack/Slack.php";
# Slack extension configuration options
$wgSlackWebhookURL = "https://hooks.slack.com/services/some-webhook-url"
$wgSlackUserName = "batman";
$wgSlackChannel = "#recent-changes";
$wgSlackIconURL = "http://i.picresize.com/images/2015/09/20/tdpsU.jpg";
$wgSlackLinkUsers = true;
@bladeSk
bladeSk / SQLite-PHP-quickstart.php
Last active April 15, 2024 15:55
SQLite3 PHP Quickstart Tutorial
<?php
// This file walks you through the most common features of PHP's SQLite3 API.
// The code is runnable in its entirety and results in an `analytics.sqlite` file.
// Create a new database, if the file doesn't exist and open it for reading/writing.
// The extension of the file is arbitrary.
$db = new SQLite3('analytics.sqlite', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
// Errors are emitted as warnings by default, enable proper error handling.
@cwhsu1984
cwhsu1984 / parse_raw_http_request.php
Last active March 17, 2023 01:59
parse multi-dimensional form-data from PATCH request
<?php
// The code is inspired by the following discussions and post:
// http://stackoverflow.com/questions/5483851/manually-parse-raw-http-data-with-php/5488449#5488449
// http://www.chlab.ch/blog/archives/webdevelopment/manually-parse-raw-http-data-php
/**
* Parse raw HTTP request data
*
* Pass in $a_data as an array. This is done by reference to avoid copying
@aaronhoffman
aaronhoffman / aws-sns-event-template-with-actual-ses-deliverynotification-sns-message
Last active January 15, 2019 19:04
Lambda function to process a Amazon SES Delivery Notification message from a SNS Topic into a DynamoDB Table
{
"Records": [
{
"EventSource":"aws:sns",
"EventVersion":"1.0",
"EventSubscriptionArn":"arn:aws:sns:us-west-2:xxxx:xxxx",
"Sns": {
"Type":"Notification",
"MessageId":"88B1B251-2E92-4FC3-BFAA-E3BBD0BAB10A",
"TopicArn":"arn:aws:sns:us-west-2:881222951025:survey-tool-ses-delivery",
@rpgreen
rpgreen / master.vm
Created February 23, 2016 00:02
API Gateway "Send Everything" Mapping Template
## API Gateway "Send Everything" Mapping Template - Ryan Green - ryang@ryang.ca
## See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html
#set($allParams = $input.params())
{
"body-json" : "$input.json('$')",
"params" : {
#foreach($type in $allParams.keySet())
#set($params = $allParams.get($type))
"$type" : {
#foreach($paramName in $params.keySet())
@nmcgann
nmcgann / install-cluster-client.config
Created January 13, 2016 09:10
AWS Elastic Beanstalk .ebextensions config to install Elasticache memcached cluster client (PHP 5.6)
files:
"/home/ec2-user/install-cluster-client.sh":
mode: "000744"
owner: root
group: root
content: |
#!/bin/bash
#hide old ini
if [ -a /etc/php.d/50-memcached.ini ]
then
@umidjons
umidjons / random-hash-string-php.md
Created April 29, 2015 10:56
Generate random hash string in PHP

Generate random hash string in PHP

<?php
function randHash($len=32)
{
	return substr(md5(openssl_random_pseudo_bytes(20)),-$len);
}
{
"Mississippi": [30.1477890014648, 34.9960556030273, -91.6550140380859, -88.0980072021484],
"Oklahoma": [33.6191940307617, 37.0021362304688, -103.002571105957, -94.4312133789062],
"Delaware": [38.4511260986328, 39.8394355773926, -75.7890472412109, -74.9846343994141],
"Minnesota": [43.4994277954102, 49.3844909667969, -97.2392654418945, -89.4833831787109],
"Illinois": [36.9701309204102, 42.5083045959473, -91.513053894043, -87.0199203491211],
"Arkansas": [33.0041046142578, 36.4996032714844, -94.6178131103516, -89.6422424316406],
"New Mexico": [31.3323001861572, 37.0001411437988, -109.050178527832, -103.000862121582],
"Indiana": [37.7717399597168, 41.7613716125488, -88.0997085571289, -84.7845764160156],
"Louisiana": [28.9210300445557, 33.019458770752, -94.0431518554688, -88.817008972168],
@tobsn
tobsn / base
Created May 28, 2014 14:28
nginx - sub_filter replace head with the current folder as base href for sub project folder structure
location / {
if ($uri ~* ^/([^.\?/]+)) {
set $foldername "$1";
}
sub_filter "<head>" "<head><base href=\"${scheme}://${host}/${foldername}/\">";
}