Skip to content

Instantly share code, notes, and snippets.

Avatar

Maximiliano Churichi mchurichi

View GitHub Profile
@mchurichi
mchurichi / relationships.json
Created Aug 30, 2022
Federation Relationships sample
View relationships.json
{
"federationRelationships": [
{
"trustDomain": "one.org",
"bundleEndpointURL": "https://one.org/bundle",
"bundleEndpointProfile": "https_web",
"trustDomainBundleFormat": "pem",
"trustDomainBundle": "-----BEGIN CERTIFICATE-----\nMIIBmjCCAUCgAwIBAgIRAKpiAzGgNbvEzW4x9hwvT10wCgYIKoZIzj0EAwIwHjEL\nMAkGA1UEBhMCVVMxDzANBgNVBAoTBlNQSUZGRTAeFw0yMjA4MzAwMTEzNDhaFw0z\nMjA4MjcwMTEzNThaMB4xCzAJBgNVBAYTAlVTMQ8wDQYDVQQKEwZTUElGRkUwWTAT\nBgcqhkjOPQIBBggqhkjOPQMBBwNCAATmRBUW6+vP+bPmL3CPiVgHlPUjWk4KIKRB\nhMmGs857U0FuDQLP/6co0zPGo6p0DdlF8gNNzRrm+ClAjm9T2Ql0o18wXTAOBgNV\nHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUbTnANqhKvdbF\nSovpgj59ZvdvMJwwGwYDVR0RBBQwEoYQc3BpZmZlOi8vb25lLm9yZzAKBggqhkjO\nPQQDAgNIADBFAiAmd6SoiczL/CxrcgnR85K1FnnX7XSe30qG6Bki+W3g5QIhAJYv\nZUFPRou/ueQ7968gHmQ+rEZXaOalmCtKc/q7yNii\n-----END CERTIFICATE-----"
},
{
@mchurichi
mchurichi / copy-all.sh
Last active Mar 27, 2022
Docker & Kubernetes snippets
View copy-all.sh
#Copy docker images from a registry to another one given a pattern
#!/bin/bash
SRC_REGISTRY=localhost:5000
DST_REGISTRY=public.ecr.aws/xxxxxxx
NEW_TAG=latest
docker images --format "{{.ID}} {{.Repository}}" | while read line; do
pieces=($line)
@mchurichi
mchurichi / Dockerfile
Created Nov 17, 2018
Raspbian ZoneMinder Dockerfile
View Dockerfile
FROM resin/rpi-raspbian:latest
EXPOSE 80
VOLUME ["/config"]
RUN apt-get update && \
apt-get upgrade; \
RUN echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list; \
@mchurichi
mchurichi / kubelogs.sh
Created May 19, 2018
Script to see k8s logs using kubectl and multitail
View kubelogs.sh
#!/bin/bash
REGEX='s/('$1'*-[a-z0-9\-]*)(.*)/\1/g'
POD=`kubectl get pods | grep $1 | sed -E $REGEX`
multitail -f --config $HOME/multitail.conf -CS $1 -l 'kubectl logs '$POD' -f'
@mchurichi
mchurichi / wsgi.py
Last active May 15, 2018
How to run a Flask app locally over https
View wsgi.py
@app.cli.command()
def secure(length):
context = ('certs/server.crt', 'certs/server.key')
app.run(host='0.0.0.0', port=443, debug=True, ssl_context=context)
#$ export FLASK_APP=wsgi.py flask secure
@mchurichi
mchurichi / script.js
Created May 13, 2018
Delete daily records in RescueTime
View script.js
const links = document.querySelectorAll('.delete-time-for-activity-link');
for (let i = 0; i < links.length; i++) {
setTimeout(() => {
links[i].click();
setTimeout(() => document.querySelector('.delete-entity-time button').click(), 1000);
}, i*5000);
}
@mchurichi
mchurichi / withLoader.js
Created May 10, 2018
React's Higher-Order Component to show a Semantic-UI-React Loading spinner
View withLoader.js
import React, { Component } from 'react';
import { Loader } from 'semantic-ui-react';
const withLoader = (WrappedComponent, dataProps) => (
class LoaderHOC extends Component {
render() {
const prop = this.props[dataProps];
return (!prop || Object.keys(prop).length === 0)
? <Loader active />
: <WrappedComponent {...this.props} />;
@mchurichi
mchurichi / .eslintrc.json
Created May 10, 2018
ESLint custom rules over react-app standard
View .eslintrc.json
{
"extends": "react-app",
"rules": {
"semi": "warn",
"no-compare-neg-zero": "warn",
"no-extra-semi": "warn",
"no-invalid-regexp": "warn",
"valid-jsdoc": "warn",
"array-callback-return": "warn",
"consistent-return": "warn",
@mchurichi
mchurichi / keybidings.json
Created May 10, 2018
VS Code custom keybindings
View keybidings.json
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "cmd+s",
"command": "workbench.action.files.saveAll",
},
{
"key": "cmd+d",
"command": "editor.action.copyLinesDownAction",
},