Skip to content

Instantly share code, notes, and snippets.

View jamezrin's full-sized avatar

Jaime Martínez Rincón jamezrin

View GitHub Profile
@jamezrin
jamezrin / test_adb.py
Created September 6, 2018 16:48
Take screenshot with python-adb and save it to a file
import os
from adb import adb_commands
from adb import sign_m2crypto
# Devices running KitKat or later require auth
signer = sign_m2crypto.M2CryptoSigner(
os.path.expanduser('~/.android/adbkey'))
# Connect to the device
device = adb_commands.AdbCommands()
@jamezrin
jamezrin / !RebootToOs.md
Created October 21, 2018 22:41 — forked from Darkhogg/!RebootToOs.md
"Reboot to {OS}" scripts for rEFInd Next Boot selection

Reboot to {OS}

This a collection of notes and files used in my quest to create "Reboot to Windows" and "Reboot to Linux" scripts (and desktop shortcuts) for Linux and Windows respectively that automatically reboot my system and instruct rEFInd to auto-select the appropriate OS entry.

General Information

The key for achieving this is to modify the EFI Variable PreviousBoot with GUID 36d08fa7-cf0b-42f5-8f14-68df73ed3740, which rEFInd uses to store the last entry selected in the menu and, if using the + default entry, will be used to select the default OS. By doing this, we trick rEFInd into booting the OS we choose without having to be physically there to press the keyboard.

@jamezrin
jamezrin / .zshrc-base
Last active December 31, 2019 21:03
My zshrc base dotfile
# Enable autocompletions
autoload -Uz compinit
typeset -i updated_at=$(date +'%j' -r ~/.zcompdump 2>/dev/null || stat -f '%Sm' -t '%j' ~/.zcompdump 2>/dev/null)
if [ $(date +'%j') != $updated_at ]; then
compinit -i
else
compinit -C -i
fi
(env) pi@raspberrypi:~/algo-master $ ./algo
PLAY [Ask user for the input] *****************************************************************************************************************************************************************
TASK [Gathering Facts] ************************************************************************************************************************************************************************
ok: [localhost]
[pause]
What provider would you like to use?
1. DigitalOcean
2. Amazon Lightsail
@jamezrin
jamezrin / orphan.py
Last active June 25, 2022 13:34
Python script to create an orphan branch
import requests
def create_orphan_branch(repository, authentication, branch_name,
github_api_path='https://api.github.com'):
res1 = requests.get(
github_api_path + '/repos/{0}/{1}/git/refs/heads/{2}'.format(
repository['owner'],
repository['name'],
branch_name
@jamezrin
jamezrin / script.js
Last active March 15, 2019 23:20
Control de preguntas en tests mediante las flechas de dirección
// ==UserScript==
// @name eTestWeb / Controles por Teclado
// @namespace https://jamezrin.name
// @version 0.2
// @description Control de preguntas en tests mediante las flechas de dirección
// @author jaime@jamezrin.name
// @match *://www.carnetcnae.com/*
// @grant all
// ==/UserScript==
@jamezrin
jamezrin / script.js
Created March 15, 2019 23:20
Posicionamiento alternativo de la imagen de la autoescuela
// ==UserScript==
// @name eTestWeb / Estilo mejorado
// @namespace https://jamezrin.name
// @version 0.1
// @description Posicionamiento alternativo de la imagen de la autoescuela
// @author jaime@jamezrin.name
// @match *://www.carnetcnae.com/*
// @grant all
// ==/UserScript==
@jamezrin
jamezrin / main.py
Last active April 13, 2019 22:29
Script to map files with nested maps to a flat structure with paths separated by dots
import argparse
import sys
from ruamel.yaml import YAML, YAMLError
yaml = YAML()
yaml.allow_unicode = True
yaml.allow_duplicate_keys = True
# Spotify AdBlock - Host file
# Blocks all annoying Spotify ads & analytics
# Updated 2018-11-21
# Credits: CHEF-KOCH (original maintainer) and LocalFigurez
# spclient.wg.spotify.com might break Spotify. Commented out by default
# audio-fa.scdn.co might break Chromecast. Commented out by default
# open.spotify.com might break Discord. Commented out by default
0.0.0.0 spclient.wg.spotify.com
# 0.0.0.0 audio-fa.scdn.co
# 0.0.0.0 open.spotify.com
#!/bin/bash
INTERVAL=0.1s
BUTTON_CODE=3
TARGET_WINDOW="Minecraft"
CLICKS=0
RUNNING=true
START_TIMESTAMP="$(date +%s)"