Skip to content

Instantly share code, notes, and snippets.

Avatar

Maximiliano Churichi mchurichi

View GitHub Profile
@mchurichi
mchurichi / PYTHON_RECIPES.md
Last active February 27, 2018 18:06
Python recipes
View PYTHON_RECIPES.md

Install package in development mode

pip install -e /path/to/mypackage
@mchurichi
mchurichi / keybidings.json
Created May 10, 2018 21:42
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",
},
@mchurichi
mchurichi / .bashrc
Created September 21, 2017 18:11
git aliases
View .bashrc
# logs
# short form, with colors and branch/tag annotations
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
# changed files per commit
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
# no color
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
# one line commits
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short # git lds -1 (long standup)
View .bashrc
SSH_ENV=$HOME/.ssh/environment
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
/usr/bin/ssh-add
@mchurichi
mchurichi / .eslintrc.json
Created May 10, 2018 21:47
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 / withLoader.js
Created May 10, 2018 21:50
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 / kubelogs.sh
Created May 19, 2018 00:59
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 / script.js
Created May 13, 2018 22:17
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 / Dockerfile
Created November 17, 2018 16:18
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; \