Skip to content

Instantly share code, notes, and snippets.

View dterracino's full-sized avatar
🐢
I may be slow to respond…

David Terracino dterracino

🐢
I may be slow to respond…
View GitHub Profile
@dterracino
dterracino / createiso-demo.ps1
Created October 27, 2019 06:48 — forked from marnix/createiso-demo.ps1
Demo for PowerShell script to create ISO using IMAPI COM component, as a simplification for StackOverflow answer http://stackoverflow.com/a/8325316/223837
# Inspiration from
#
# http://blogs.msdn.com/b/opticalstorage/archive/2010/08/13/writing-optical-discs-using-imapi-2-in-powershell.aspx
#
# and
#
# http://tools.start-automating.com/Install-ExportISOCommand/
#
# with help from
#
@dterracino
dterracino / ads_block_detect.js
Created January 29, 2020 06:59 — forked from maztch/ads_block_detect.js
Detects ads blockers
var adBlockEnabled = false;
var testAd = document.createElement('div');
testAd.innerHTML = ' ';
testAd.className = 'adsbox';
document.body.appendChild(testAd);
window.setTimeout(function() {
if (testAd.offsetHeight === 0) {
adBlockEnabled = true;
}
testAd.remove();
@dterracino
dterracino / humantype.cs
Created February 12, 2020 01:05 — forked from Quahu/humantype.cs
Humanize C# generic types.
public static string Humanize(this Type type, bool includeNamespace = false)
{
// simply return its name
if (!type.IsGenericType)
return includeNamespace ? $"{type.Namespace}.{type.Name}" : type.Name;
// what are you doing
if (type.IsNested && type.DeclaringType.IsGenericType)
throw new NotImplementedException();
@dterracino
dterracino / ping.cs
Created February 12, 2020 01:06 — forked from Quahu/ping.cs
An example ping command. Assumes your modules are using the SocketCommandContext.
[Command("ping")]
[Alias("latency")]
[Summary("Shows the websocket connection's latency and time it takes for me send a message.")]
public async Task PingAsync()
{
// start a new stopwatch to measure the time it takes for us to send a message
var sw = Stopwatch.StartNew();
// send the message and store it for later modification
var msg = await ReplyAsync($"**Websocket latency**: {Context.Client.Latency}ms\n" +
@dterracino
dterracino / randomimage.cs
Last active February 12, 2020 01:06 — forked from Quahu/randomimage.cs
An example command that sends a random image from a predefined array each time it's used.
// define a static array of paths that we'll choose the image from
// we make it static so it isn't reinstantiated unnecessarily each time we run a command from this module
private static string[] _imagePaths = new[] { "images/hackerman.jpg", "images/computerman.jpg", "images/polarbear.png" };
[Command("image")]
[Alias("picture")]
[Summary("Sends a random image.")]
public async Task ImageAsync()
{
// using a new instance of the Random class we randomize a path with an index from 0 to x - 1, where x is the amount of paths in the array
@dterracino
dterracino / hr-pass-gen.php
Last active December 20, 2023 17:03 — forked from joshhartman/randomPassword.php
Human Readable Password Generator
<?php
function randomPassword($len = 10){
/* Programmed by Christian Haensel
** [email protected]
** http://www.chftp.com
**
** Exclusively published on weberdev.com.
** If you like my scripts, please let me know or link to me.
** You may copy, redistribute, change and alter my scripts as
** long as this information remains intact.
https://raw.githubusercontent.com/EnergizedProtection/block/master/unified/formats/hosts.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adaway.org/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adblock-nocoin-list/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/adguard-simplified/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/anudeepnd-adservers/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/anudeepnd-coinminer/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/anudeepnd-facebook/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/anudeepnd-facebook/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/blocklist.kowabit.de/list.txt
https://raw.githubusercontent.com/hectorm/hmirror/master/data/disconnect.me-ad/list.txt
@dterracino
dterracino / Spock.py
Created February 27, 2020 21:57 — forked from Echocage/Spock.py
import random
relationships = {'Spock': {'Scissors': 'smashes', 'Rock': 'vaporizes'},
'Scissors': {'Paper': 'cuts', 'Lizard': 'decapitates'},
'Lizard': {'Paper': 'eats', 'Spock': 'poisons'},
'Rock': {'Lizard': 'crushes', 'Scissors': 'crushes'},
'Paper': {'Spock': 'disapproves', 'Rock': 'covers'}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GBVideoTimeCalc
{
class Program
@dterracino
dterracino / prettify_aws_profile.user.js
Created April 3, 2020 21:21 — forked from M4C4R/prettify_aws_profile.user.js
Prettifies the AWS navbar where the role, account, and region are located. Click Raw to install on script managers like GreaseMonkey and Tampermonkey.
// ==UserScript==
// @name Make AWS Profile and Region Clearer
// @version 1.2
// @include https://*console.aws.amazon.com/*
// ==/UserScript==
// *** START Configuration ***
const fontSize = '17px';
const safeUserNames = ['view'];