Skip to content

Instantly share code, notes, and snippets.

View thedava's full-sized avatar

David S. thedava

View GitHub Profile
@thedava
thedava / watch.sh
Created May 26, 2017 13:33
Watch a directory for new files
#!/usr/bin/env bash
# https://unix.stackexchange.com/a/249238
echo "Start watching for new files"
> watch.log
while true
do
touch watch.log
sleep 10
find . -type f -cnewer ./watch.log | tee -a watch.log
@thedava
thedava / Bit.cs
Created March 1, 2017 10:28
Bit / byte display
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DavaHome.Tools
{
public class Bit
{
public enum Type
@thedava
thedava / AssemblyLoader.cs
Created March 1, 2017 10:27
Assembly Loader
/**
* Original Author: Lars Holm
* Improved Usage: David Sommer
* Since: 03.02.2012
**/
using System;
using System.Reflection;
using System.Resources;
@thedava
thedava / clear.sh
Last active December 16, 2017 16:37
Encrypt files as zip Archive
#!/bin/bash
echo "This script will remove all non-zip and non-sh files"
echo "Continue in 5 seconds..."
sleep 5
echo "Clearing..."
find . -type f -not -name "*.zip" -and -not -name "*.sh" -print0 | xargs -0 rm
echo "done"
@thedava
thedava / composer.sh
Last active December 16, 2017 16:32
Composer aliases
#!/bin/bash
getcomposer () {
if [[ -f 'composer.phar' ]]; then
php composer.phar self-update
else
wget https://getcomposer.org/composer.phar
fi
}
@thedava
thedava / cygwin-aptget.sh
Created January 18, 2017 09:07
Tiny apt-get wrapper for cygwin64
#!/bin/bash
apt-get () {
setup_file='/cygdrive/c/cygwin64/setup-x86_64.exe'
cmd=$1
if [[ ! -f $setup_file ]]; then
cmd='update'
fi
@thedava
thedava / dd.sh
Last active December 16, 2017 16:36
Using dd (disc dump)
#!/bin/bash
# Dump hdd as file
dd if=/dev/sda of=./file.raw
# Convert raw file to vdi (Virtual Box)
VBoxManage convertdd file.raw file.vdi --format VDI
# Mount raw image
fdisk -l file.raw
@thedava
thedava / append-jQuery.js
Created January 3, 2017 20:56
Append jQuery to JavaScript
var js = document.createElement("script");
js.type = "text/javascript";
js.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js";
document.body.appendChild(js);
@thedava
thedava / ItemOverview.cs
Created December 31, 2016 01:34
Space Engineers Item Overview
const int PANEL_LINES = 18;
string[] panels = new string[] {
"Ore Counter LCD #1",
"Ore Counter LCD #2",
"Ore Counter LCD #3"
};
string[] storageObjects = new string[] {
"Refinery",
"Cargo",