Skip to content

Instantly share code, notes, and snippets.

View molguin92's full-sized avatar

Manuel Olguín Muñoz, Ph.D. molguin92

View GitHub Profile
@molguin92
molguin92 / cloudSettings
Last active March 30, 2022 13:16
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-03-30T13:16:00.737Z","extensionVersion":"v3.4.3"}
@molguin92
molguin92 / results.txt
Created September 20, 2017 15:08
ML Lab 1
*** ASSIGNMENT 1 ***
Entropies:
M1Test - 1.0
M2Test - 0.957117428264771
M3Test - 0.9998061328047111
*** ASSIGNMENT 3 ***
M1: [0.0752726, 0.0058384, 0.0047076, 0.0263117, 0.2870307, 0.0007579]
M2: [0.0037562, 0.0024585, 0.0010561, 0.0156642, 0.0172772, 0.0062476]
@molguin92
molguin92 / adb+
Created May 2, 2018 13:37
Python script for parallel execution of ADB commands on all connected devices.
#!/usr/bin/env python3
from subprocess import run, PIPE, Popen
from multiprocessing.pool import Pool
from itertools import repeat
from sys import argv
import shlex
def _run_adb(device: str, args: list) -> None:
cmd = ' '.join(['adb', '-s {}'.format(device)] + args)
print(cmd)
FROM ubuntu
RUN apt-get update
RUN apt-get install -y build-essential curl
# NodeJS >= 6.0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs
# ttfautohint
@molguin92
molguin92 / flash_fw.sh
Created May 28, 2018 12:11
Flash Firmware Xiaomi
#!/bin/bash -x
# 1) Go to Xiaomis Fastboot Update Page. http://en.miui.com/a-234.html
# 2) Download latest Fastboot ROM. Like latest China dev.
# 3) Extract the content.
# 4) Boot your phone to Bootloader Mode. Vol Down and Power. Until Fastboot shows up.
# 5) Run this script from the root folder of the downloaded files.
echo "Flashing Firmware"
cat "./misc.txt"
@molguin92
molguin92 / ReadWriteLock.py
Last active June 27, 2018 09:55
Python utility functions and classes (3.5+!)
import threading
class ReadWriteLock:
"""
A lock object that allows many simultaneous "read locks", but
only one "write lock."
Modified from
https://www.safaribooksonline.com/library/view/python-cookbook/0596001673/ch06s04.html
"""
@molguin92
molguin92 / runVM.sh
Created September 3, 2018 11:40
Run VM and SSH in
#!/bin/bash
# Script for automatically running a VBox VM in headless mode and SSH into it
# start VM
VMNAME="KaliLinux"
echo "Starting Kali Linux Virtual Machine"
VBoxHeadless --startvm $VMNAME > /dev/null 2>&1 &
# show a spinner while it warms up
WAIT=20
@molguin92
molguin92 / eights.py
Created November 12, 2018 20:17
Brute Force 8s Puzzle
#!/usr/bin/env python3
import random
choices = list('8+*-/')
result = None
while result != 100:
eights_left = 8
expr = ''
on_operator = True
while eights_left > 0:
@molguin92
molguin92 / server.py
Created September 8, 2021 19:38
EchoServer
from typing import Tuple
from loguru import logger
from twisted.internet import reactor
from twisted.internet.posixbase import PosixReactorBase
from twisted.internet.protocol import DatagramProtocol
reactor: PosixReactorBase = reactor