Skip to content

Instantly share code, notes, and snippets.

View muhqu's full-sized avatar

Mathias Leppich muhqu

View GitHub Profile
[
{log_levels,[{connection, error}]}
].
#!/bin/bash
sudo apt-get update
sudo apt-get install nginx -y
echo '
resolver 172.16.0.23; # AWS DNS Server
resolver_timeout 5s;
upstream search {
server search-YOUR-ENDPOINT-HERE.us-east-1.cloudsearch.amazonaws.com:80;
<?php
class A {
function create() {
return new static();
}
}
class B extends A {
}
@muhqu
muhqu / marked
Last active December 18, 2015 19:09
#!/bin/bash
/usr/local/bin/marked "$@" \
| sed \
-e 's!\[\ \]!<input type="checkbox" onclick="return false" onkeydown="return false">!' \
-e 's!\[[.\-]\]!<input type="checkbox" onclick="return false" onkeydown="return false" indeterminate>!' \
-e 's!\[[√xX]\]!<input type="checkbox" onclick="return false" onkeydown="return false" checked>!' \
| awk '{print;if($0~/indeterminate/)found=1;}END{if(found)print "<script>window.addEventListener(\"load\",function(){var arr=document.querySelectorAll(\"input[type=checkbox][indeterminate]\");for(i in arr)arr[i].indeterminate=true;});</script>"}'
Scenario: Repost a 3D Post
Given there is user A
And there is user B following user A
And there is user C following user B
And there is user D following user A and B
And user A posted a photo P1
And user A posted a 3D photo P2
When user B reposted P2 as P3
Then the feeds should be like:
| feed | of | count | contains | because |
/* github style diff colors */
.diff .file .diffcontent .lines,
.diff .file .diffcontent .lineno {
font-family: Consolas, "Liberation Mono", Courier, monospace;
font-size: 13px;
line-height: 18px;
text-shadow: 0 1px 0 rgba(255,255,255,0.25);
background-color: #fff;
}
var commonPrefix = function(a, b) {
if (a === b) return a;
var i = 0;
while (a.charAt(i) == b.charAt(i))++i;
return a.substring(0, i);
}
var commonSuffix = function(a, b) {
if (a === b) return "";
var i = a.length - 1,
k = b.length - 1;
@muhqu
muhqu / A-Pen-by-Mathias-Leppich.markdown
Created August 30, 2013 06:14
A Pen by Mathias Leppich.
$mem->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
$mem->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
!=
$mem->setOption(Memcached::OPT_DISTRIBUTION, Memcached::DISTRIBUTION_CONSISTENT);
$mem->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
@muhqu
muhqu / cloudwatch-spot-price-metrics.sh
Last active December 7, 2017 20:55
Shell Script to bring EC2 SpotInstance Prices to CloudWatch.
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Mathias Leppich <mleppich@muhqu.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell