Skip to content

Instantly share code, notes, and snippets.

View dsappet's full-sized avatar

Douglas Sappet dsappet

View GitHub Profile
@dsappet
dsappet / kali_osx_persistence_wifi.md
Created February 28, 2022 03:13 — forked from widdowquinn/kali_osx_persistence_wifi.md
Kali Linux Live USB with persistence and wireless on Macbook Pro

Kali Linux Bootable USB with Persistence and Wireless on OSX

Download the appropriate Kali Linux .iso

I used a 64 bit .iso image, downloaded via HTTP. I downloaded the amd64 weekly version, as the pool linux headers (needed below for installation of wireless drivers) were ahead of the stable release kernel.

Download the SHA256SUMS and SHA256SUMS.gpg files from the same location.

@dsappet
dsappet / stencil-helper.js
Created January 17, 2021 20:13 — forked from dogoku/stencil-helper.js
A function that simplifies compiling and running stencil source code in the browser
function loadStencilCompiler(doc = document) {
const s = doc.createElement('script');
// loading from jsdelivr because skypack is not converting this file correctly
s.src = 'https://cdn.jsdelivr.net/npm/@stencil/core@latest/compiler/stencil.min.js';
return new Promise((resolve, reject) => {
s.onload = () => resolve(window.stencil.transpile);
s.onerror = reject;
doc.body.appendChild(s);
});
}
@dsappet
dsappet / new_pastebin.sh
Last active September 12, 2018 23:40
bash script to post a files contents to pastebin
#! /bin/sh
# To use this script give it an argument that is the absolute path to the file you want to upload
# like this:
# sh new_pastebin.sh /Users/your_username/file_to_upload.txt
echo "\n"
# The required parameters
@dsappet
dsappet / EnumHelper.cs
Last active January 19, 2018 19:22
Enum helper methods I have found useful
public static class EnumHelper
{
/// <summary>
/// Gets an attribute on an enum field value
/// </summary>
/// <typeparam name="T">The type of the attribute you want to retrieve</typeparam>
/// <param name="enumVal">The enum value</param>
/// <returns>The attribute of type T that exists on the enum value</returns>
/// <example>string desc = myEnumVariable.GetAttributeOfType<DescriptionAttribute>().Description;</example>
public static T GetAttributeOfType<T>(this Enum enumVal) where T:System.Attribute
@dsappet
dsappet / FileInfoExtensions
Last active October 27, 2017 19:43
SafeMoveTo is a moveTo function that moves a file but if the destination file already exists it appends _i to the end of the filename until i is an int which causes the filename not to exist in directory.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EdiService.Extentions
{
public static class FileInfoExtensions
@dsappet
dsappet / isNullOrWhitespace.js
Last active October 2, 2017 14:32
String Utilities in Javascript using AngularJS
(function (angular) {
angular.module('Sprague.Framework').run(function () {
String.prototype.isNullOrWhitespace = function () {
var str = this;
return str === null || str.match(/^\s*$/) !== null;
};
String.prototype.isNullOrWhitespace = function (str) {
return str === null || str.match(/^\s*$/) !== null;
@dsappet
dsappet / XamarinIosUsefulFunctions.cs
Created October 21, 2016 17:20
Some simple useful stuff for xamarin ios
/// <summary>
/// Call it to force dismiss keyboard when background is tapped
/// Just call this in the viewdidload() of a controller and any keyboard will dismiss on tapping outside the keyboard
/// </summary>
protected void DismissKeyboardOnBackgroundTap()
{
// Add gesture recognizer to hide keyboard
var tap = new UITapGestureRecognizer { CancelsTouchesInView = false };
tap.AddTarget(() => View.EndEditing(true));
View.AddGestureRecognizer(tap);
@dsappet
dsappet / StringUtilities.cs
Created October 21, 2016 17:18
String Utilities. (Check for valid email using regex, )
using System.Text.RegularExpressions;
public static class StringUtilities
{
static Regex ValidEmailRegex = CreateValidEmailRegex();
/// <summary>
/// Taken from http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx
/// </summary>
/// <returns></returns>
private static Regex CreateValidEmailRegex()
@dsappet
dsappet / StringExtensions.cs
Created October 20, 2016 19:07
Useful string extension methods
public static class StringExtensions
{
public static string AddSpacesAtCapitals(this string text, bool preserveAcronyms = true)
{
if (string.IsNullOrWhiteSpace(text))
return string.Empty;
StringBuilder newText = new StringBuilder(text.Length * 2);
newText.Append(text[0]);
for (int i = 1; i < text.Length; i++)
{
public static class Extensions
{
public static bool HasProperty(this Type obj, string propertyName)
{
if (string.IsNullOrWhiteSpace(propertyName)) return false;
return obj.GetRuntimeProperty(propertyName) != null;
}
}