Skip to content

Instantly share code, notes, and snippets.

@maciakl
maciakl / elevate.cmd
Last active January 8, 2025 20:57
If your batch file needs to run as Administrator, put this at the top of your script. It will initiate a UAC prompt and run the rest of the script in elevated mode.
if "%1" == "elevated" goto start
powershell -command "Start-Process %~nx0 elevated -Verb runas"
goto :EOF
:start
rem your code goes here
#!/bin/bash
# This script defines environment variables which allow you to
# easily colorize your scripts.
#
# At the start of your bash script simply source this file like this:
#
# [ -f "$HOME/scripts/colors" ] && source $HOME/scripts/colors
#
# Then you can use all the variables to colorize output like this:
@maciakl
maciakl / makeafile
Last active June 21, 2019 14:13
Make a file of a specific size
#!/bin/bash
die() {
echo>&2 " Usage: makefile <filename> <size>"
echo>&2 " size is in format <number><unit> where unit can be K,M,G, etc... Example: 256K, 10M, 1G."
exit 1
}
[ "$#" -eq 2 ] || die
dd if=/dev/urandom of=$1 bs=$2 count=1
@maciakl
maciakl / tunnel-create
Last active June 21, 2019 14:05
Scripts for SSH Tunneling
#!/bin/bash
# Script to tunnel to a remote server from a firewall using a third
# server in the middle.
[ -f "$HOME/scripts/colors" ] && source $HOME/scripts/colors
USAGE="USAGE:\n\t tunnel-create $Color_Blue BOUNCE_SERVER DESTINATION$COlor_Off $Color_Cyan[BOUNCE_PORT] [DEST_PORT]$Color_Off\n\n"
USAGE+="\t $Color_Blue BOUNCE_SERVER$Color_Off\t - Server through which you will be tunneling\n"
USAGE+="\t $Color_Blue DESTINATION$Color_Off\t - Server you want to ssh into.\n"
@maciakl
maciakl / index.html
Created June 3, 2019 20:33
Very basic status monitoring page for your local network.
<!doctype html>
<html>
<head>
<title>System Status</title>
<style>
body {
margin-top: 50px;
margin-left: 25%;
margin-right: 25%;
@maciakl
maciakl / wannacry-patch-check.vbs
Created May 15, 2017 19:58
Very quick and dirty script for checking if Win7 computer has one of the required WannaCry / WannaCrypt patches. Have user double click and run. It will show a notification prompt when done, and generate a log file indicating which patch it detected if any.
'Enter the name of the computer to check:
ComputerName = "." 'Replace the dot with a computer name, to connect to a remote computer
Dim pop
Set pop = CreateObject("WScript.Shell")
set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO=CreateObject("Scripting.FileSystemObject")
outFile= WshShell.SpecialFolders("Desktop") & "\PATCH.LOG.TXT"
Set logfile = objFSO.CreateTextFile(outFile,True)
@maciakl
maciakl / index.html
Last active December 14, 2020 21:56
Sample Project Website Skeleton for CSIT Students
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<!-- do not edit above this line -->
<meta name="author" content="***">
<title> Page Title</title>
</head>
@maciakl
maciakl / Makefile
Created June 14, 2016 13:29
Pandoc, continous compilation setup.
# Run watch -n1 make
files := $(shell xargs -a COMPILELIST.TXT)
index.html: $(files)
pandoc $(files) --toc -f markdown -t html -c style.css -o $@
@maciakl
maciakl / .latexmkrc
Created May 11, 2016 14:21
Latexmk Config File
$pdflatex = "pdflatex -interaction=nonstopmode %O %S";
$pdf_previewer = "start evince";
$pdf_update_method = 0;
@maciakl
maciakl / FreeBSD-install-notes.mkd
Last active March 16, 2016 18:42
FreeBSD install notes

FreeBSD Installation Notes

Some notes about installing and configuring BSD machines:

Disable Hardware Bell

Edit /etc/sysctl.conf and add the following line:

hw.syscons.bell=0