Skip to content

Instantly share code, notes, and snippets.

View franga2000's full-sized avatar

Miha Frangež franga2000

View GitHub Profile
@franga2000
franga2000 / Ultimate home server guide.md
Created August 26, 2015 19:17
Ultimate home server

Ultimate home server 2015

#Setup services It's best to run these commands in a folder you can later delete, since some of them generate temporary files. ##Samba Firts, you have to open the following ports:

  • netbios-ns - 137/tcp
  • netbios-dgm - 138/tcp
  • netbios-ssn - 139/tcp
@franga2000
franga2000 / time.js
Last active December 19, 2015 11:56
Functions to process time and time zones
//Get UTC/GMT Offset
new Date().getTimezoneOffset() / -60; /* Type: integer */
//Get timezone offset string: GMT, GMT+01:00, GMT-01:30
function getTimeZoneString() {
var num = new Date().getTimezoneOffset();
if (num === 0) {
return "GMT";
} else {
var hours = Math.floor(num / 60);
@franga2000
franga2000 / networking.sh
Created January 28, 2016 17:13
Bash cheat sheet
# Get interface's MAC address
# $INTERFACE : Interface name (e.g. wlan0)
$(cat /sys/class/net/$INTERFACE/address)
@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:

@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 / GNOME 3 post-install.sh
Last active August 23, 2016 14:18
GNOME 3 post-install script
#!/bin/bash
# Set up .bashrc
cat >> ~/.bashrc <<EOL
# BEGIN franga2000's .bashrc stuff & things
# Aliases
alias ll='ls -alh'
alias l='ls -CF'
alias du='du -h'
@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
"""
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]
// ==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) {
/*
* 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) {