Skip to content

Instantly share code, notes, and snippets.

View erickmendonca's full-sized avatar
:shipit:
Shippin'

Erick Mendonça erickmendonca

:shipit:
Shippin'
View GitHub Profile
@erickmendonca
erickmendonca / blockingChecks.ts
Created July 9, 2020 22:58
probot-auto-merge check for required checks only
import { ConditionConfig } from './../config'
import { PullRequestInfo } from '../models'
import { ConditionResult } from '../condition'
import { groupByLastMap, flatMap } from '../utils'
import { CheckStatusState } from '../github-models'
import myAppId from '../myappid'
function requiredChecks (pullRequestInfo: PullRequestInfo): Array<String> {
const baseRef = pullRequestInfo.baseRef.name
const branchProtectionRules = pullRequestInfo.repository.branchProtectionRules
@erickmendonca
erickmendonca / tunnel.applescript
Created July 16, 2018 04:06
Connect to VPN on Tunnelblick (macOS) with time-generated password
-- connect to VPN on Tunnelblick with timegen password
tell application "/Applications/Tunnelblick.app"
set oauthpass to do shell script "oathtool --base32 YOUR_SECRET_HERE --totp"
connect "CONFIG_NAME"
delay 0.5
tell application "System Events" to keystroke oauthpass
tell application "System Events" to keystroke return
end tell
@erickmendonca
erickmendonca / all_errors_serializer.py
Created March 27, 2018 20:53
Serializer - throw all errors at the end of validation
from typing import Mapping
from collections import OrderedDict
from django.core.exceptions import ValidationError as DjangoValidationError
from rest_framework import serializers
from rest_framework.fields import empty
class AllErrorsSerializer(serializers.Serializer):
'''
This serializer avoids erroring out sooner on data missing
@erickmendonca
erickmendonca / choice.py
Created March 1, 2018 07:52
PonyORM Choice field
# Choice field for PonyORM similar to Django https://docs.djangoproject.com/en/2.0/ref/models/fields/#choices
# Use it like this:
# class SomeModel(db.Entity):
# some_field = Choice(choices={
# 'key': 'Value',
# 'som': 'Something',
# 'ano': 'Another thing',
# })
@erickmendonca
erickmendonca / WARNING.md
Created January 25, 2018 18:02 — forked from Ambroos/WARNING.md
Remove SentinelOne agent from Mac. Because honestly, it doesn't seem to do anything at all. Run as root.

USE AT OWN RISK

This was only tested on a partial SentinelOne installation on the High Sierra beta, where SentinelOne was never allowed to enable it's kernel extension.

@erickmendonca
erickmendonca / vscode-styles.css
Created August 16, 2017 16:58 — forked from td0/VSCode-custom.css
vscode-styles for operator mono, fira code ligatures, and oceanic next italic
.type.storage,.type.storage.declaration, .storage.class.modifier {
font-family: 'Operator Mono';
}
.type.storage.arrow.function {
font-family: 'Fira Code'
}
.token.keyword.operator {
font-family: 'Fira Code'
@erickmendonca
erickmendonca / hash.py
Last active July 30, 2017 02:42
Gotchas
data = {
'full_name': 'Bruce Banner',
'birth_date': '1962-05-01',
# a lot of other data
}
cache_id = hash(data['full_name']) | hash(data['birth_date'])
cache.set(cache_id, data)
@erickmendonca
erickmendonca / geocode.py
Created May 28, 2017 02:04
Get LatLong for addresses
import sys
import requests
import urllib
from typing import Iterator, Dict, Tuple, List
FILENAME = 'list.txt'
GOOGLE_MAPS_URL = 'https://maps.googleapis.com/maps/api/geocode/json'
API_KEY = ''
@erickmendonca
erickmendonca / gdgajubot.yaml
Last active July 2, 2017 00:16
GDG Aracaju bot settings
debug_mode: false
events_source: meetup
links:
"google developers": "https://developers.google.com/groups/chapter/117712497785310292400/"
"facebook page": "https://www.facebook.com/gdgaracaju"
"facebook group": "https://www.facebook.com/groups/gdgaracaju"
"twitter": "https://twitter.com/gdgaracaju"
"google+": "https://plus.google.com/+GDGAracajuBlogspotBR"
"medium": "http://medium.com/gdg-aracaju"
"meetup": "https://www.meetup.com/gdgaracaju/"
@erickmendonca
erickmendonca / test_config_file.yml
Last active March 2, 2017 01:08
Testing config file for GDGAjuBot
debug_mode: true
events_source: facebook
groups:
-
meetup: "group_name_1"
facebook: "group_name_1"
-
meetup: "group_name_2"
facebook: "group_name_2"
links: