Skip to content

Instantly share code, notes, and snippets.

View elgalu's full-sized avatar

Leo Gallucci elgalu

View GitHub Profile
@elgalu
elgalu / keybindings.pl
Created January 19, 2014 22:27
Export Ubuntu shortcuts: keybindings.pl -e keys.csv ;; Import (DANGER) Ubuntu shortcuts: keybindings.pl -i keys.csv
#!/usr/bin/perl
use strict;
my $action = '';
my $filename = '-';
for my $arg (@ARGV){
if ($arg eq "-e" or $arg eq "--export"){
$action = 'export';
@elgalu
elgalu / process3dGraph.py
Last active April 23, 2023 14:27 — forked from jerilkuriakose/process3dGraph.py
This is a script which draws the amount of CPU used and memory usage of a process to a 3D graph. Python 3
#coding:utf-8
import psutil
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
TIME_NUM = 90
FRAMES = 360
@elgalu
elgalu / .Xresources
Created April 13, 2023 16:55 — forked from taviso/.Xresources
XTerm Configuration
! XTerm resources
!
! Remember to run `xrdb < .Xresources` after changing anything.
!
! Tavis Ormandy <taviso@gmail.com>
! Set the default UI font (menus, toolbar, etc)
XTerm*XftFont: Segoe UI:size=10:antialias=true:style=Regular
! Color of UI Components
@elgalu
elgalu / exceptional_ruby_book_quiz.rb
Created November 22, 2012 21:26
Exceptional Ruby: Master the Art of Handling Failure in Ruby by Avdi Grimm
Great book! Here are my quiz notes:
- What is the diff bt raise and fail?
=> no diff
- Are raise//fail ruby keywords or methods?
=> Kernel#raise (are methods)
- Re-raise last exception
=>

Both things have been introduced recently, and let you access even private ec2 instances

  1. Without VPN
  2. No open SSH port
  3. Authentication / Authorization is fully delegated to IAM
# Assumes valid AWS Credentials in ENV
@elgalu
elgalu / debug.sh
Created August 18, 2021 19:14 — forked from snstanton/debug.sh
Remote debugging k8s with pycharm
job_name=debug-`date +%Y%m%d%H%M%S`
kubectl create job ${job_name} --from cj/myveeva-v118273-app-maint
kubectl label pod -l job-name=${job_name} run=debug
kubectl wait --for condition=Ready pod -l job-name=${job_name}
pod_name=`kubectl get pods -l job-name=${job_name} -o jsonpath='{.items[0].metadata.name}'`
echo "installing tools"
kubectl exec ${pod_name} -- sh -c "apk -q update; apk -q add bash curl jq openssh rsync vim unzip postgresql-client; pip install -q ipython"
@elgalu
elgalu / capabilities.js
Last active May 18, 2021 14:41
Protractor Browser Capabilities Extensions
////////////////////////////////////////////////
// Protractor Browser Capabilities Extensions //
////////////////////////////////////////////////
"use strict";
module.exports = browser.getCapabilities().then(function(s) {
var browserName, browserVersion;
var shortName, shortVersion;
var ie, ff, ch, sa;
var platform;
@elgalu
elgalu / waitReady.js
Last active February 2, 2021 07:14
Actively wait for an element present and displayed up to specTimeoutMs ignoring useless webdriver errors like StaleElementError.
/**
* Actively wait for an element present and displayed up to specTimeoutMs
* ignoring useless webdriver errors like StaleElementError.
*
* Usage:
* Add `require('./waitReady.js');` in your onPrepare block or file.
*
* @example
* expect($('.some-html-class').waitReady()).toBeTruthy();
*/
@elgalu
elgalu / a-drip-of-javascript-quiz.js
Created September 4, 2013 23:10
A Drip of JavaScript - book notes / quizzes
// Explain what the Function.prototype.bind method allows.
// Use properly to fix this TypeError: Illegal invocation
var myLog = console.log;
myLog("hola");
=>
// The bind method allows us to create a new function which is permanently bound to a given value of `this`
var myLog = console.log.bind(console);
myLog("hola"); //==> "hola"
// As a bonus, you can't override its `this` value using call or apply.
myLog.call(window, "hello"); // will be ignored and will keep bound to console.log()
@elgalu
elgalu / toHaveClass.js
Last active August 2, 2019 21:38
toHaveClass custom Jasmine 1.3.1 html class matcher
"use strict";
var maxWaitTimeoutMs = 5000; // 5secs
var webdriver = require('selenium-webdriver');
var flow = webdriver.promise.controlFlow();
/**
* Custom Jasmine matcher builder that waits for an element to have
* or not have an html class.
* @param {String} expectation The html class name