Skip to content

Instantly share code, notes, and snippets.

docker swarm join --token SWMTKN-1-00g6i4vsi18mw3o1fmmtnvolgoofjgdommssqknhjysw1mztux-2thgkwk3m4zr7f5my3i17yf6w 192.168.0.130:2377
@JohnRuddy
JohnRuddy / mini-reverse-listener.ps1
Created September 18, 2022 17:23 — forked from staaldraad/mini-reverse-listener.ps1
A reverse shell listener in powershell
$socket = new-object System.Net.Sockets.TcpListener('127.0.0.1', 413);
if($socket -eq $null){
exit 1
}
$socket.start()
$client = $socket.AcceptTcpClient()
write-output "[*] Connection!"
@JohnRuddy
JohnRuddy / Create C# Class From Database Object.txt
Created May 16, 2019 14:17
Create C# Class From Database Object
declare @TableName sysname = 'Person'
declare @Result varchar(max) = 'public class ' + @TableName + '
{'
select @Result = @Result + '
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; }
'
from
(
select
@JohnRuddy
JohnRuddy / Database Restoring.sql
Created September 17, 2018 08:17
Database caught in "Restoring" state after a restore. Run the below to rectify.
RESTORE DATABASE aptify WITH RECOVERY;
@JohnRuddy
JohnRuddy / WebsiteChecker.cs
Last active January 30, 2017 21:19
Check List of Status of List of Websites
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace WebsiteChecker
{
@JohnRuddy
JohnRuddy / Fibonacci_Search.JAVA
Created March 31, 2016 13:25
The Fibonacci search uses the divide and conquer algorithm to sort the array, the Fibonacci search is an addition to the binary search in simple words it is an extension to the binary search.
//This is a java program to search an element using Fibonacci search
import java.util.Scanner;
public class Fibonacci_Search
{
static int kk = -1, nn = -1;
static int fib[] = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,
377, 610, 98, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368,
75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309,
3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986,
@JohnRuddy
JohnRuddy / Euro2016RepublicOfIrelandGroups.cs
Created December 12, 2015 16:46
Republic of Ireland - Euro 2016 Draw
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Euro2016RepublicOfIrelandGroups
{
// 4 teams in a group
class Group
@JohnRuddy
JohnRuddy / gist:d982cc13196434e6e2c5
Created October 23, 2014 15:05
Capture a screenshot with Selenium WebDriver
((ITakesScreenshot)_driver).GetScreenshot().SaveAsFile("Sscreenshot.jpg", ImageFormat.Jpeg);
@JohnRuddy
JohnRuddy / gist:5481927
Created April 29, 2013 14:30
EPiServer - Get Page ID From Page Folder ID
-- Get Page ID of a Page Folders Page.
SELECT
pkID
FROM
tblPage
WHERE ExternalFolderID = <somepageid>
@JohnRuddy
JohnRuddy / HTMLAgilityPack-Images
Last active December 15, 2015 09:09
HTMLAgilityPack - Retrieve image urls from image from some HTML.
var urls = document.DocumentNode.Descendants("img")
.Select(e => e.GetAttributeValue("src", null))
.Where(s => !String.IsNullOrEmpty(s));