Skip to content

Instantly share code, notes, and snippets.

View pstuifzand's full-sized avatar

Peter Stuifzand pstuifzand

View GitHub Profile
@pstuifzand
pstuifzand / var_table.php
Created November 16, 2021 11:16
Indent PHP array as a table. Arrays and objects become tables as well
/**
* @param array $result
* @param int $depth
* @return void
*/
function var_table(array $result, int $depth = 0): void
{
$indent = str_repeat(" ", $depth * 4);
if (empty($result)) {
echo sprintf("%s<empty>\n", $indent);
@pstuifzand
pstuifzand / Install-on-Neovim.md
Last active August 1, 2023 15:10
Install Home Assistant Language Server on Neovim (v0.5 prerelease)

Install on Neovim (v0.5 prerelease)

The Home Assistant language server can be used with Neovim.

Install vscode-home-assistant

  1. Download the latest release from the releases.
  2. Unpack the archive.
  3. Run npm install
  4. Run npm run compile
@pstuifzand
pstuifzand / openssl_commands.md
Created May 18, 2019 09:56 — forked from p3t3r67x0/openssl_commands.md
Some list of openssl commands for check and verify your keys

openssl

Install

Install the OpenSSL on Debian based systems

sudo apt-get install openssl
@pstuifzand
pstuifzand / format.p6
Last active August 26, 2017 22:56
Format duration in Perl6
sub format-duration(Duration:D $d --> Str) {
join "", reverse ($d.Rat.polymod(60, 60, 24) Z <s m h d>).grep:{$_[0] != 0} or "0s"
}
sub format-duration2(Duration:D $d --> Str) {
($d.Rat.polymod(60, 60, 24) Z <s m h d>).grep({$_[0] != 0}).reverse.flat.join("") or "0s";
}
@pstuifzand
pstuifzand / Dockerfile
Created July 19, 2017 17:29
Docker for jirasearch
FROM golang:latest
WORKDIR /go/src/github.com/pstuifzand/jirasearch
EXPOSE 8081
COPY CompileDaemon /go
CMD [ "/go/CompileDaemon", "-build", "go build -v -o /go/bin/app ./cmd/server/main.go", "-command", "/go/bin/app" ]
@pstuifzand
pstuifzand / log-mouse
Created January 8, 2017 21:06
Log mouse position to csv.
#!/bin/bash
while true; do
xdotool getmouselocation 2>&1 | sed -rn '${s/x:([0-9]+) y:([0-9]+) .*/\1,\2/p}' >> mouselocation.csv
sleep 1
@pstuifzand
pstuifzand / log-keyboard.md
Last active February 8, 2021 19:43
Keyboard logger
@pstuifzand
pstuifzand / content.html
Last active November 26, 2016 20:48
Example of a perl program that uses Marpa::R2::HTML to convert part of an html file to blade syntax.
<html>
<body>
<div>
<div class="kw-content">
<h1>test</h1>
<div class="panel-content">
<div class="panel panel-default">
<div class="form-group">
<input id="name" type="text" name="title">
<input id="name" type="number" name="title">
@pstuifzand
pstuifzand / .projections.json
Created November 15, 2016 20:14
Projections for Magento
{
"Model/*.php": { "type": "model" },
"Model/Resource/*.php": { "type": "resource" },
"Block/*.php": { "type": "block" },
"Helper/*.php": {
"type": "helper",
"template": [
"<?php",
"",
"class extends Mage_Core_Helper_Abstract",
A BEGIN
@yield('content')
A END