Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import sys
import requests
import time
uah_user = ""
uah_password = ""
@victor141516
victor141516 / notificador_notas_uah.py
Last active January 28, 2017 02:23
[uah_user : "Usuario de la universidad"] [uah_password : "Contraseña de la universidad"] [telegram_bot_api_key : "API key de un bot de telegram"] [telegram_channel : "Nombre del canal (@Nombre) en el que el bot anterior tiene permiso para escribir (estoy hay que hacerlo desde la app de telegram)"] [subject : "Nombre de la asignatura tal cual apa…
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import sys
import requests
import time
uah_user = ""
uah_password = ""
@victor141516
victor141516 / hostsm
Last active January 31, 2018 10:49
Add entries /etc/hosts temporally
#! /bin/sh
if [ "$1" == "-e" ]; then
"${EDITOR:-vi}" hosts
exit;
fi
if [ "$1" == "-r" ]; then
if [ -e hosts ]; then
read -p "Remove temporal hosts (Y/n)? " choice
@victor141516
victor141516 / change-macos-password-using-otp.py
Created April 25, 2018 15:44
Change macOS password using a one-time-password. You can use any OTP app like GAuthenticator or Authy. It does send both old and new password to Telegram on every password change.
import os
import pyotp
import requests
import subprocess
import time
CHANNEL_NAME = ''
BOT_TOKEN = ''
CURRENT_PASSWORD = None # Write here your current password if it's the first time using this
@victor141516
victor141516 / liveReload.py
Last active June 19, 2018 14:52
Watch code on path (argv[1]) and say if there has been chages on port (argv[2]). The code for frontend in commented in the head. It will install Flask
# setInterval(() => {
# fetch('http://127.0.0.1:15555', {mode: 'cors'}).then(res => res.text().then(text => {
# if (text === '1') {
# location.reload();
# }
# }));
# }, 1000);
import os
import subprocess
@victor141516
victor141516 / onmouseover_highlight_and_get_selector.js
Last active January 25, 2019 10:51
onmouseover_highlight_and_get_selector.js
// https://github.com/gmmorris/simmerjs
(function(){var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.owns=function(d,k){return Object.prototype.hasOwnProperty.call(d,k)};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(d,k,e){d!=Array.prototype&&d!=Object.prototype&&(d[k]=e.value)}; $jscomp.getGlobal=function(d){return"undefined"!=typeof window&&window===d?d:"undefined"!=typeof global&&null!=global?global:d};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(d,k,e,h){if(k){e=$jscomp.global;d=d.split(".");for(h=0;h<d.length-1;h++){var q=d[h];q in e||(e[q]={});e=e[q]}d=d[d.length-1];h=e[d];k=k(h);k!=h&&null!=k&&$jscomp.defineProperty(e,d,{configurable:!0,writable:!0,value:k})}}; $jscomp.polyfill("Object.assign",function(d){return d?d:function(d,e){for(var k=1;k<arguments.length;k++){var q=arguments[k];if(q)for(var r in q)$jscomp.owns(q,r)&&(d[r]=
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @param {!SDK.DOMNode} node
* @param {boolean=} justSelector
* @return {string}
*/
fullQualifiedSelector = function (node, justSelector) {
@victor141516
victor141516 / doxtrak.sh
Last active March 25, 2019 15:47
Extract all layers of a Docker image as files
#!/bin/sh
if [ $# -eq 0 ]
then
echo "Usage: doxtrak [docker image name]"
exit
fi
echo "Extracting..."
@victor141516
victor141516 / lsshcode.sh
Last active May 17, 2019 12:03
It mimics sshcode behaviour but using your local VSCode. Creates a vfs using sshfs then opens it using VSCode, then umounts and deletes it at VSCode close event. Add to your .bashrc/.zshrc
function sshlcode {
DIR=.$(echo $1 | sed 's/[@.:\/]/_/g') && \
sshfs $1 $DIR && \
code --new-window --wait $DIR ; \
until umount $DIR; do sleep 0.1; done && \
rmdir $DIR
}
alias grgl='git remote -v get-url origin | sed -e "s/^git@/https#\/\//g" -e "s/:\//\//g" -e "s/https#\/\//https:\/\//g" -e "s/\.git$//g"'
alias gro='open $(grgl)'
alias grop='open $(grgl)/pipelines'