Skip to content

Instantly share code, notes, and snippets.

View tulik's full-sized avatar
:octocat:
Kubernetes!

Lukasz D. Tulikowski tulik

:octocat:
Kubernetes!
View GitHub Profile
@tulik
tulik / voice.xml
Last active September 27, 2019 10:13
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup/>
</Response>
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: 2018-10-04T16:55:29Z
generateName: symfony-blackfire-76b6d644ff-
labels:
app: symfony-blackfire
pod-template-hash: "3262820099"
release: symfony-4-docker-runtime-env
name: symfony-blackfire-76b6d644ff-tj989
@tulik
tulik / tic-tac-toe.sql
Created October 2, 2018 16:23
TicTacToe in SQL (Postgres)
--- Introduced by Mariusz Krynski.
with recursive rnd_move(move) as (
select *, random() rnd from generate_series(1, 9) move
), winning_positions(a, b, c) as (
values (1, 2, 3), (4, 5, 6), (7, 8, 9), -- rows
(1, 4, 7), (2, 5, 8), (3, 6, 9), -- cols
(1, 5, 9), (3, 5, 7) -- diagonals
), game as (
select 'O' as who_next, ARRAY['.', '.', '.', '.', '.', '.', '.', '.', '.'] as board
@import url(https://fonts.googleapis.com/css?family=Roboto:400,700,500,300);@import url(https://fonts.googleapis.com/css?family=Roboto+Mono:400,700,500,300);@keyframes a{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes b{0%{opacity:1}50%{opacity:0}to{opacity:1}}[src$="blue.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjMDA5Njg4IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptLTIgMTVsLTUtNSAxLjQxLTEuNDFMMTAgMTQuMTdsNy41OS03LjU5TDE5IDhsLTkgOXoiLz48L3N2Zz4=)}[src$="red.png"]{background-image:url(data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjE4IiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxOCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBmaWxsPSIjRjQ0MzM2IiBkPSJNMTIgMkM2LjQ4IDIgMiA2LjQ4IDIgMTJzNC40OCAxMCAxMCAxMCAxMC00LjQ4IDEwLTEwUzE3LjUyIDIgMTIgMnptMSAxNWgtMnYtMmgydjJ6bTAtNGgtMlY3aDJ2NnoiLz48L3N2Zz4=)}[src$="yellow.png
@tulik
tulik / foo.sh
Created August 31, 2018 10:03
My shell cheats
# Rename all files in directory to start with upper case letter
for i in *; do first=$(echo "${i:0:1}" | tr '[:lower:]' '[:upper:]'); new=$first${i:1}; mv "$i" "$new"; done
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
void bench(void (*f)(int));
void if_func_1(int i);
void if_func_2(int i);
void if_func_3(int i);
int main() {
package main
import (
"fmt"
"time"
)
func main() {
bench(if_func_1)
bench(if_func_2)
'use strict';
function run(callback) {
main(bench, v8_mute, callback);
main(bench, if_func_1, callback);
main(bench, if_func_2, callback);
main(bench, if_func_3, callback);
}
function main(bench, func) {
public function vendors(): Collection
{
return $this->belongsToMany(Vendor::class);
}
public function index(): Response
{
$products = Product::with('vendors')->get();
if (!$products) {