Skip to content

Instantly share code, notes, and snippets.

@alenbasic
alenbasic / iso2usb.sh
Created August 12, 2020 12:21
Linux version of an earlier iso2usb script I made
#!/bin/bash
# iso2usb is a simple script for OSX to ease the conversion of an iso to an img file
# and then dd that img file to a USB of your choosing. You simply give it the iso
# as a parameter and then the disk number and it will take care of the rest.
# based on the commands here: http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx
# and the color commands here: http://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
# exits out of the script upon error
@alenbasic
alenbasic / profile.json
Created October 20, 2019 11:20
Monokai like theme for Windows Terminal
// replace the empty schemes section with this or copy the relevant bit into your current schemes set up
"schemes": [
{
"background" : "#292E36",
"foreground" : "#F8F8F0",
"black" : "#6A6A6A",
"blue" : "#2a94a8",
"green" : "#85C258",
"cyan" : "#48BBD1",
"red" : "#DD4242",
@alenbasic
alenbasic / JSON.ahk
Last active April 15, 2020 02:51 — forked from wizcas/winterm-callout.ahk
AHK Script for calling out Windows Terminal in a drop down fashion
/**
* Lib: JSON.ahk
* JSON lib for AutoHotkey.
* Version:
* v2.1.3 [updated 04/18/2016 (MM/DD/YYYY)]
* License:
* WTFPL [http://wtfpl.net/]
* Requirements:
* Latest version of AutoHotkey (v1.1+ or v2.0-a+)
* Installation:
@alenbasic
alenbasic / ipget.py
Created September 19, 2019 13:41
Gets your current external IP and stores it in a DB. Sends a pushover notification when it changes. Designed to be used as a cron job
#! /usr/bin/python3
import sys, os, ipaddress, sqlite3, requests
from tabulate import tabulate #you can download tabulate via pip install
DATABASE_FILE = 'FILE_LOCATION_HERE'
DATABASE_EXISTS = os.path.isfile(DATABASE_FILE)
MESSAGE = 'Script ran successfully. A message should appear here every hour.'
@alenbasic
alenbasic / index.php
Created September 6, 2016 13:15
Share links and bits of texts between devices at with this php based notepad
<html>
<head>
<title>Paste Stuff</title>
<link rel="stylesheet" href="pure-min.css">
</head>
<body>
<div align="center">
<h1>Paste Stuff</h1>
<form class="pure-form pure-form-aligned" action="/" name="notes" method="post">
<fieldset class="pure-group">
@alenbasic
alenbasic / sgraph.py
Created August 10, 2016 13:35
A text "call graph" generator for SQR files. Checks procedures for calls to other procedures and prints the procedures and the calls they make.
#!/usr/bin/python
import sys
f = open(sys.argv[1],'r').readlines()
arr = []
proc = False
for line in f:
if "begin-pro" in line:
print line.strip()
proc = True
@alenbasic
alenbasic / gogur.go
Created July 23, 2016 05:58
Gogur - A command line app to upload pics to imgur written in go-lang
package main
import (
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
@alenbasic
alenbasic / nsqrt.go
Created June 23, 2016 12:08
A go-lang implementation of Newton's square root approximation.
package main
import (
"fmt"
)
// inspired by https://tour.golang.org/flowcontrol/8
func Sqrt(loop int, seed, square float64) float64 {
@alenbasic
alenbasic / hugo_post.py
Created June 22, 2016 11:54
I often find myself manually changing the title name and forgetting to append ".md" in hugo so I quickly wrote this up so I wouldn't have to remember anymore :)
#!/usr/bin/python
import subprocess, string, os, re
# Important variables up here to make it easier to change later on
_BLOG_DIR = "/path/to/blog/here"
_BLOG_DIR_CONTENT = _BLOG_DIR + "/content/"
_EDITOR = "mate" # I use textmate, but you can change this to whatever you want
@alenbasic
alenbasic / bubsort.py
Created June 17, 2016 13:06
A slightly refined bubble sort function.
def bubsort(a):
i = len(a)
counter = 0
while i > 0:
for j in range(len(a)):
h = j+1
if h < len(a):
if a[j] > a[h]:
temp = a[h]
a[h] = a[j]