Skip to content

Instantly share code, notes, and snippets.

View aurbano's full-sized avatar
🎯
ML

Alejandro U. Alvarez aurbano

🎯
ML
View GitHub Profile
@aurbano
aurbano / measure.py
Created March 20, 2024 17:12
Measure average lines of code and time to review of PRs
import requests
from datetime import datetime
import csv
GITHUB_TOKEN = ""
ORG = ""
REPO = ""
MAX_PAGES = 1
@aurbano
aurbano / check-required-prs.yaml
Created October 6, 2023 12:44
Github Action: Ensure that "Required PRs" are merged before merging the current one
name: Check Required PRs
on:
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
check-linked-prs:
runs-on: ubuntu-latest
steps:
@aurbano
aurbano / crypto.ts
Created April 4, 2020 16:21
Generate a symmetric key, encrypt a message, export the key, import the key and decrypt the message
// Temporary Encryption Demo
// 1. generate an encryption key
const algorithm = "AES-GCM";
const iv = window.crypto.getRandomValues(new Uint8Array(12));
crypto.subtle.generateKey(
{
name: algorithm,
length: 256,
}, true, ['encrypt', 'decrypt']).then(key => {
console.log('key', key);
@aurbano
aurbano / conversation.md
Last active September 10, 2019 23:46
Bluehost Support regarding malware

The following conversation was literally copy/pasted from Bluehost's support.

I thought it was pretty interesting how they kept trying to upsell an unnecessary "security" service for $80/month for 20 minutes...

The malware in question is a script from Coinhive (I've linked an article as the main site doesn't seem to load) which I was testing out from a security point of view. Unfortunately their security scanner picked it up quickly and suspended the account, which is expected and good.

During the chat I didn't realise this was the problem though, I later saw it when I went to remove the malware and looked at the scanner log (which said it had found SL-CRYPTOMINER-eu.UNOFFICIAL FOUND) and immediately thought of Coinhive.

Malware/Security: Site Deactivated for Malware

@aurbano
aurbano / Gemfile
Last active November 8, 2023 01:39
Post code coverage as a comment to a Github PR from Circle CI
source "https://rubygems.org"
gem "octokit"
gem "nokogiri"
gem "json"
@aurbano
aurbano / random.js
Created March 6, 2017 15:28
UTTT Random Player
const UTTT = require('ultimate-ttt');
/**
* Random client implementation of the UTTT Game
*/
class Random{
constructor(player, size = 3){
if(!player || !Number.isInteger(player) || player < 1 || player > 2){
throw new Error('Invalid player');
@aurbano
aurbano / keybase.md
Created January 12, 2017 15:31
Keybase proof of identity

Keybase proof

I hereby claim:

  • I am aurbano on github.
  • I am aurbano (https://keybase.io/aurbano) on keybase.
  • I have a public key ASCbcc9fttWsjSlcvPXb20XFpbJ7vq7WKRLLxLLOrPFh3go

To claim this, I am signing this object:

@aurbano
aurbano / resource-path.js
Last active January 14, 2020 10:44
Standalone resource URL parser - loosely based on Angular's resource. Available as NPM package: https://github.com/aurbano/resource-path
/**
* This method is intended for encoding *key* or *value* parts of query component. We need a
* custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
* have to be encoded per http://tools.ietf.org/html/rfc3986:
* query = *( pchar / "/" / "?" )
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
* / "*" / "+" / "," / ";" / "="
@aurbano
aurbano / regex.md
Last active October 27, 2016 14:11
Match a word preceded by specific words, but not others, and with optional appendixes

Regex

((pre1)|pre2)?(?(1)\s)(?<!notallowed )main word(?(2)-appendix1)

This will match

pre1 main word-appendix1 pre2 main word

<!DOCTYPE html>
<html><head>
<title>Obfuscated name remapper</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body {
background: white;
color: black;
font-family: "Trebuchet MS",Helvetica,Tahoma,Arial,sans-serif;
font-size: 90.01%;