Skip to content

Instantly share code, notes, and snippets.

View franga2000's full-sized avatar

Miha Frangež franga2000

View GitHub Profile
#!/bin/bash
# Run this before comitting new code
export C_CLEAR='\e[0m'
export C_GREEN='\e[1;32m'
export C_CYAN='\e[1;36m'
export C_RED='\e[1;31m'
export C_YELLOW='\e[1;33m'
function prompt_to_exit() {
# Sleeps until an interface is configured
# Param 1 is the interface name
function wait_for_iface() {
while ip a | grep $1 | grep "state DOWN" > /dev/null; do
sleep 1
done
}
/*
* Sort a list of django-taggit-labels tags so they use as few rows as possible.
* Using the first-fit algorithm (https://en.wikipedia.org/wiki/Bin_packing_problem#First-fit_algorithm)
*/
function packTags(tags) {
var $tags = $(tags);
var max = $tags.outerWidth(true);
function widths(els) {
// ==UserScript==
// @name WiGLE MAC address manufacturer lookup
// @namespace com.franga2000
// @downloadUrl https://gist.githubusercontent.com/franga2000/e9fe898fb2f0efeaf284598dff6e216c/raw/GM_WiGLE_OUI.js
// @match https://wigle.net/mapsearch*
// @run-at document-idle
// @grant none
// ==/UserScript==
function loadTitle(el) {
"""
Generates iterations of string from lines in a file
Usage: permutations.py <filename:str> <number:int>
Example: permutations.py wordlist.txt 2
"""
import sys
from itertools import permutations
f = sys.argv[1]
@franga2000
franga2000 / .bashrc
Created January 18, 2017 11:59
My awesome .bashrc - feel free to steal stuff
# franga2000's .bashrc of awesomness
# Human-readable units
alias ll='ls -alh'
alias l='ls -CF'
alias du='du -h'
alias df='df -h'
alias free='free -h'
# Disaster prevention
@franga2000
franga2000 / shittyPresentationScript.bat
Created January 3, 2017 18:57
A shitty screen sharing script I use for presentations sometimes
@echo off
rem Uses SpaceDesk (http://spacedesk.ph/download/)
rem Put in the same folder as: spacedeskPersonalView.exe, XML wifi profile file (Wi-Fi-FrangezM.xml)
rem Run script, plug in wifi card (ONLY IF there isn't one), start hotspot on laptop (same settings as XML)
rem When Spacedesk opens, CTRL+SHIFT+C for connect menu, ALT+Enter for fullscreen
rem When done, close Spacedesk, the script will clean up the rest
rem Switch to Unicode
@chcp 65001
rem CD to script folder
@franga2000
franga2000 / Config.java
Created August 13, 2016 22:39
Some old config class I wrote that actually works quite nicely
package com.franga2000.capturetheflag.config;
import java.io.File;
import java.io.IOException;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import com.franga2000.capturetheflag.Main;
import com.franga2000.capturetheflag.Util;
@franga2000
franga2000 / keybase.md
Created August 9, 2016 17:06
Keybase proof

Keybase proof

I hereby claim:

  • I am franga2000 on github.
  • I am franga2000 (https://keybase.io/franga2000) on keybase.
  • I have a public key whose fingerprint is C6DE B11F F21D 08CC D7D0 2ACC 3FA8 1634 2139 C3E3

To claim this, I am signing this object:

#!/usr/bin/env python3
import discord
import random
import os
import asyncio
import logging
logging.basicConfig(level=logging.INFO)
def rand_file(path):