Skip to content

Instantly share code, notes, and snippets.

View joubertredrat's full-sized avatar

Joubert RedRat joubertredrat

View GitHub Profile
@joubertredrat
joubertredrat / .editorconfig
Last active November 28, 2021 15:45
Editorconfig and gitignore for go projects
root = true
[*]
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[{Makefile,go.mod,go.sum,*.go}]
@joubertredrat
joubertredrat / git-clone-github
Created November 18, 2021 00:42
Clone a Github repository into a new directory with user as prefix
#!/bin/sh
# git-clone-github
# Clone a Github repository into a new directory with user as prefix
# Usage: git clone-github github-repo-url
set -e
clone_url=$1
if [[ $clone_url != https://github.com/* && $clone_url != http://github.com/* ]]
then
@joubertredrat
joubertredrat / howto.md
Created June 12, 2020 13:09 — forked from petrkohut/howto.md
How to have redis-cli and psql installed on machine using Docker

How to install redis-cli and psql client on your machine with Docker

Preparing docker images

We will use minimalistic Linux distribution called Alpine (5MB)

Dockerfile of redis-cli

FROM alpine:latest
RUN apk --update add redis
@joubertredrat
joubertredrat / readme.md
Last active September 26, 2019 13:04
Regras do concurso cosplay na escola E.E Professor João Câmara

Concurso cosplay na escola E.E Professor João Câmara

Regras

  • A inscrição deverá ser feita pelo formulário online .
  • É necessário enviar pelo menos uma foto do personagem de referência.
  • O cosplay será avaliado por 2 critérios, fidelidade e desenvoltura na apresentação por 3 pessoas juradas.
  • O cosplayer terá 1 minuto para realizar sua apresentação, o cosplayer que exceder este tempo será penalizado.

Premiação

@joubertredrat
joubertredrat / test.php
Last active September 19, 2019 17:38
A bizarre mock that works
<?php
namespace Tests;
use GuzzleHttp\Client;
use Tests\TestCase;
/**
* Any Test
*
#!/usr/bin/env bash
l=$(wmctrl -l | grep -i -o "0[xX][0-9a-z]*")
for i in $(echo $l); do
wmctrl -i -r $i -b toggle,maximized_horz,maximized_vert
done
for i in $(echo $l); do
wmctrl -i -r $i -b toggle,maximized_horz,maximized_vert
@joubertredrat
joubertredrat / index.php
Created August 9, 2019 21:21
encrypt decrypt test
<?php
$publicKeyString = "-----BEGIN PUBLIC KEY-----
-----END PUBLIC KEY-----";
$privateKeyString = "-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----";
$publicKey = openssl_pkey_get_public($publicKeyString);
@joubertredrat
joubertredrat / values.yml
Last active March 27, 2019 22:09
File with configuration for overwritten on istio install by helm
gateways:
istio-ingressgateway:
serviceAnnotations:
"service.beta.kubernetes.io/aws-load-balancer-internal": "0.0.0.0/0"
@joubertredrat
joubertredrat / example.php
Last active January 22, 2019 20:41
PHP RFC: array_element_exists function
<?php
require('polyfill.php');
$array = ['a', 'A', 'A', 'A', 'a', 't'];
var_dump(
array_element_exists('a', $array),
array_element_exists('x', $array)
);
/**
 * @return array
 */
public function toArray(): array
{
    return [
        'id' => $this->customer->getId(),
        'account' => [
            'id' => $this->customer->getAccount()->getId(),