Skip to content

Instantly share code, notes, and snippets.

View carlosrobles's full-sized avatar

carlosrobles

  • Dubai - Hong Kong - Manila - London - Barcelona
View GitHub Profile
test
@carlosrobles
carlosrobles / substack_toc.py
Last active May 20, 2024 22:01
Create a table of content for Substack using Python
import requests
#you can install lxml with `sudo pip3 install lxml`
from lxml.html import fromstring
import sys
from urllib.parse import urlparse, urlunparse, urlencode, parse_qs
import time
if len(sys.argv) < 2:
print("No arguments were given. Use URL [output_file_name]")
quit()
#include "DigiKeyboard.h"
//Command key is ord 37 and as a modifier 0x00000008
//See NX_DEVICELCMDKEYMASK http://svn.red-bean.com/bob/SDL-altivec/trunk/src/video/quartz/SDL_QuartzEvents.m
//For a look at available keys https://github.com/digistump/DigisparkArduinoIntegration/blob/master/libraries/DigisparkKeyboard/DigiKeyboard.h
#define MOD_CMD_LEFT 0x00000008
boolean do_hack = true;
void setup() {
public class AutoSuggestion {
private static final int TEN_THOUSAND_REQUESTS = 10000;
private static final int START = 0;
private static final String SEPARATOR = "--------------------------------------------------------------------" +
"---------------------------------------------------------------";
public static void main(String[] args) {
/*
@carlosrobles
carlosrobles / scrapy_lambda_layer.sh
Created August 2, 2020 10:22 — forked from haranjackson/scrapy_lambda_layer.sh
Deploys Python Scrapy library to an AWS Lambda layer. You can specify the region, library version, and runtime.
REGION=eu-west-1
VER=1.7.3
RUNTIME=python3.7
docker run -v $(pwd):/out -it lambci/lambda:build-$RUNTIME \
pip install scrapy==$VER -t /out/build/scrapy/python
cd build/scrapy
zip -r ../../scrapy.zip python/
cd ../..
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@carlosrobles
carlosrobles / Readme.txt
Created April 23, 2020 14:05 — forked from jcward/Readme.txt
Generating iOS P12 / certs without Mac OSX Keychain (on linux, windows, etc)
1) Generate a private key and certificate signing request:
openssl genrsa -out ios_distribution.key 2048
openssl req -new -key ios_distribution.key -out ios_distribution.csr -subj '/emailAddress=me@example.com, CN=Example, C=US'
2) Upload CSR to apple at: https://developer.apple.com/account/ios/certificate/create
- choose Production -> App Store and Ad Hoc
3) Download the resulting ios_distribution.cer, and convert it to .pem format:
@carlosrobles
carlosrobles / grab-all-product-attributes.sql
Created March 13, 2019 19:46 — forked from tegansnyder/grab-all-product-attributes.sql
Magento grab all product attributes for a SKU in direct SQL. "static" backend_type attributes are stored in catalog_product_entity
SELECT * FROM ( SELECT
ce.sku,
ea.attribute_id,
ea.attribute_code,
CASE ea.backend_type
WHEN 'varchar' THEN ce_varchar.value
WHEN 'int' THEN ce_int.value
WHEN 'text' THEN ce_text.value
WHEN 'decimal' THEN ce_decimal.value
WHEN 'datetime' THEN ce_datetime.value
@carlosrobles
carlosrobles / cw_exp.js
Created January 18, 2019 19:25 — forked from fbrnc/cw_exp.js
AWS Lambda function that collects relevant metrics from CloudWatch and pushes them to ElasticSearch
var AWS = require('aws-sdk');
var cloudwatch = new AWS.CloudWatch({ region: 'us-east-1'});
exports.handler = function (event, context) {
var ElasticSearchHost = 'elasticsearch.example:9200';
var Environment = 'int';
var EndTime = new Date;
var StartTime = new Date(EndTime - 15*60*1000);
var Metrics = {