Skip to content

Instantly share code, notes, and snippets.

View Reelix's full-sized avatar
🏠
Working from home

Reelix Reelix

🏠
Working from home
View GitHub Profile
@Reelix
Reelix / sshv.cs
Created September 25, 2018 01:49
A simple C# app to get the version of a remote IPs SSH client
using System;
using System.Net.Sockets;
using System.Text;
namespace SSHv
{
internal class Program
{
private static void Main(string[] args)
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms; // DLL Reference for SendKeys
namespace SniffedUSBKeyboardDataReplicator
{
class Program
{
@Reelix
Reelix / sumOfFirstXPrimeNumbers.js
Created December 18, 2016 14:22
JavaScript code to get the sum of the first X prime numbers
function isPrime(value){for(var i=2;i<value;i++){if(value%i===0){return false;}}return value>1;}
function sumOfFirstXPrimeNumbers(count){var currNum=1;var total=0;for(var j=0;j<count;j++){while(true){if(isPrime(currNum)){total+=currNum;currNum++;break;}else{currNum++;}}}return total;}
console.log(sumOfFirstXPrimeNumbers(7));
private static void Main()
{
int num1 = 2;
double num2 = 4;
var someString2 = $"{num2 / int.Parse($"{num2}") + $"_{num1}" + $"Meta{num2 / int.Parse($"{num2}") + $"_{num2 % num1 % int.Parse($"{num2}")}"}M{null}eta_{num2}Me"}";
Console.WriteLine(someString2);
Console.ReadLine();
}
<script>
function formatCurrency()
{
// Get the values from the text-boxes
var symbol = document.getElementById('formatCurrencySymbol').value;
var number = parseFloat(document.getElementById('formatCurrencyNumber').value);
var decimalPlaces = document.getElementById('formatCurrencyDecimalPlaces').value;
// Do the formatting - Regex here!
var result = symbol + number.toFixed(decimalPlaces).replace(/(\d)(?=(\d{3})+\.)/g, "$1,");
/* Gist Embed - Dark Theme Styling - Thanks to MattD */
/* Body */
.gist-data tbody { background-color: Black; }
/* Line Numbers */
.gist-data tbody td:nth-of-type(1) {
color: #2B91AF !important;
}
@Reelix
Reelix / styleMe.js
Last active November 24, 2016 10:33
<script>
// This is a comment
function someFunc()
{
console.log("Hello World!");
}
</script>
USE [master]
GO
CREATE DATABASE [insert_database_name_here] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Data\fileNameHere.mdf' ),
FOR ATTACH ;
GO
// Function
function stripChars(myWord)
{
myWord = myWord.replace(/[^\w\s]/gi, "");
alert(myWord);
}
// Button onclick event
stripChars('Hello!@!@%!@^! 5u*&%@p3r Wor(&(+)+l;d!!');
// Function
function reverseString(str)
{
str = str.split("").reverse().join("");
alert(str);
}
// Button onclick event
reverseString('I want to be reversed :D');