Skip to content

Instantly share code, notes, and snippets.

@iamsortiz
iamsortiz / edX-Course-Web_browser_console_scraping.js
Created Nov 11, 2017
Download an edX course as Markdown a file (edX - Course - Web browser console scraping)
View edX-Course-Web_browser_console_scraping.js
// Download an edX course as Markdown a file
//
// Usage:
// * Go to edX course webpage
// * Enroll
// * Get in (audit course, for example)
// * Open web browser console (tested on Chromium)
// * Paste code
// * Press intro
function extracttion() {
@iamsortiz
iamsortiz / Playing_around_with_BI_using_Python_--yml,_request,_pandas--_Javascript_--orbjs,_chratjs--.py
Created Apr 27, 2017
Playing around with BI using Python (yml, request, pandas) Javascript (orbjs, chratjs)
View Playing_around_with_BI_using_Python_--yml,_request,_pandas--_Javascript_--orbjs,_chratjs--.py
#!/usr/bin/env python
import requests
# from pprint import pprint
import json
import time
import yaml
import pandas as pd
from pandas import DataFrame
@iamsortiz
iamsortiz / kubernetes-get_dashboard_access.sh
Last active Oct 15, 2016
Kubernetes vagrant - Get dashboard access
View kubernetes-get_dashboard_access.sh
#!/bin/bash
# Usage: Assuming a vagrant based kubernetes (as in https://coreos.com/kubernetes/docs/latest/kubernetes-on-vagrant-single.html), run this script in the same folder of the Vagrantfile (where you would normally do "vagrant up")
# * Then insert the password (by default: kubernetes)
# * Browse localhost:9090
USERNAME='kubernetes'
PASSWORD='kubernetes'
function main() {
@iamsortiz
iamsortiz / create-virtual-floppy.sh
Last active Oct 15, 2016
Automated creation of virtual floppy disk with data
View create-virtual-floppy.sh
#!/bin/bash
################################################################################
#
# Automated creation of virtual floppy disk with data
#
# Usage with default config:
# * Copy your data to a folder called 'input'
# * run the script: $ ./create-virtual-floppy.sh
# * The virtual floppy disk with data can be found timestamped in a 'output' folder
#
View docker-tomcat_bash_utils.sh
IMAGE=tomcat
IMAGE_TAG=8-jre8
CONTAINER_NAME='tomcat'
CONTAINER_APPS_FOLDER='/usr/local/tomcat/webapps/'
function docker-app_container-run() {
echo $PWD
docker run -d -v $PWD/target:$CONTAINER_APPS_FOLDER --name $CONTAINER_NAME -p 8080:8080 $IMAGE:$IMAGE_TAG
}
alias docker-app_container-start="docker start $CONTAINER_NAME"
@iamsortiz
iamsortiz / docker-php_apache_modrewrite.sh
Last active Mar 25, 2019
Docker php apache modrewrite bash utils
View docker-php_apache_modrewrite.sh
# Convenience bash utils to handle docker: php + apache + modrewrite
# * related issue: https://github.com/docker-library/php/issues/179#issuecomment-234594522
#
# Usage:
# * Download the file
# * In your "bash file"
# * On debian based systems use: ~/.bashrc
# * On Mac use: ~/.bash_profile
# * Include the line: source PATH_TO_THE_DOWNLOADED_FILE
# * Or just copy and paste the contents of this file
@iamsortiz
iamsortiz / bitbucket_mass_clone_and_pull_from_project.js
Last active May 31, 2016
Bitbucket mass clone and pull --all from project repos
View bitbucket_mass_clone_and_pull_from_project.js
# Given you are in a project repo list at bitbucket (https://bitbucket.org/account/user/????/projects/???
# Open the webbrowser console
# Paste code
# Ctrl+C on prompt
# Paste on a directory where you want all the clones + pulls
# Attribution for javascript clipboard: http://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
var commands = "";
@iamsortiz
iamsortiz / drawio_to_jira_imgs.sh
Last active May 25, 2016
Given some draw.io .png diagrams, generate jpg's for the original size, and for a smaller version JIRA embeded friendly
View drawio_to_jira_imgs.sh
#!/bin/bash
# Given a folder structure
#
# * ./
# * ./raw
#
# With the draw.ioong exports at raw
#
# It will leave all your JIRA-embed-ready images at ./
@iamsortiz
iamsortiz / browserconsole-reddit-page_stats.js
Created May 14, 2016
Extract Reddit page stats from the Browser console
View browserconsole-reddit-page_stats.js
////////////////////////////////////////////////////////////////////////////////
//
// The MIT License (MIT)
//
// Copyright (c) 2016 Samuel Ortiz Reina (@iamsortiz)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
View .bashrc_lang_java_sonar.sh
################################################################################
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Samuel Ortiz Reina (@iamsortiz)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
You can’t perform that action at this time.