Skip to content

Instantly share code, notes, and snippets.

View Machy8's full-sized avatar
:octocat:
¯\_(ツ)_/¯

Vladimír Macháček Machy8

:octocat:
¯\_(ツ)_/¯
View GitHub Profile
@Machy8
Machy8 / Dockerfile
Last active April 7, 2023 01:33
PHP-FPM 7.1 with Unix Sockets + Nginx in Docker
FROM debian:stretch
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
wget \
zip \
git \
unzip && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
@Machy8
Machy8 / jquery.on.js
Last active April 6, 2024 13:07
jQuery .on() alternative in pure javascript (this handles events on dynamically added elements) 😎
/**
* @param {string} eventType
* @param {string} selector
* @param {function} callback
*/
function on(eventType, selector, callback) {
document.body.addEventListener(eventType, function (event) {
if (event.target.matches(selector)) {
callback.call(event.target);
}
@Machy8
Machy8 / installation.md
Last active May 20, 2022 08:59
Kubernetes, single node, bare metal cluster installation (Debian)
@Machy8
Machy8 / readme.md
Last active August 6, 2023 13:38
Start Kubernetes proxy server automatically
  1. Create an empty file and paste the content bellow into it /lib/systemd/system/kubectlproxy.service
[Unit]
Description=kubectl proxy 8080
After=network.target

[Service]
User=root
ExecStart=/bin/bash -c "/usr/bin/kubectl proxy --address=127.0.0.1 --port=8080"
@Machy8
Machy8 / docker-command-aliases.txt
Last active April 27, 2019 15:28
Aliases for daily work with Docker (you may need to add sudo into "docker-compose")
alias dsa='docker stop $(docker ps -a -q)' # Docker stop all
alias dc='docker-compose'
alias dcu='dc up'
alias dcuf='dc up --force-recreate'
alias dcd='dc down'
alias dcs='dc start'
alias dcr='dc restart'
alias dcst='dc stop'
alias dcb='dc build' # Docker compose build
alias dil='docker image ls' # Docker image list
@Machy8
Machy8 / AmpFiltersExtension.php
Last active July 30, 2019 20:13
Symfony Twig filters for converting content to AMP valid content
<?php
declare(strict_types = 1);
namespace App\Twig\Extensions;
use Nette\Utils\Html;
use Nette\Utils\Image;
use Nette\Utils\Validators;
use Symfony\Component\DependencyInjection\ContainerInterface;
  1. Generate ssh key (if not exists)
  • No passowrd or anything
ssh-keygen
  1. Create variable with SSH_PRIVATE_KEY and add the ~/.ssh/id_rsa private key into it
  2. Add the key into authorized keys cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
  3. Create init section in .gitlab-ci.yml
before_script:
@Machy8
Machy8 / index.html
Last active March 25, 2020 11:39
Apicart - minimum configuration - https://apicart.net
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Apicart vue bundle example">
<title>Vue default bundle example</title>
</head>
<body>
<!-- You can use custom layout. This is just for the example -->
@Machy8
Machy8 / index.html
Last active March 7, 2020 18:17
Apicart full configuration - https://apicart.net
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Apicart vue bundle example">
<title>Vue default bundle example</title>
</head>
<body>
<div style="max-width: 1902px; margin: 0 auto; padding: 0 20px;">