Skip to content

Instantly share code, notes, and snippets.

@OrigamiTech
OrigamiTech / RegexTextBox.cs
Created November 18, 2010 12:56
A standard C# System.Windows.Forms.TextBox, which changes color based on the specified Regex pattern.
using System;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
namespace WKCore
{
public partial class RegexTextBox : TextBox
{
/*http://cdn.ghostworksinc.com/github.css*/
@charset "utf-8";
@import url(http://fonts.googleapis.com/css?family=Droid+Sans:regular);
h1,h2,body { font-family: 'Droid Sans', arial, sans-serif; }
a { text-decoration: none; }
/*http://cdn.ghostworksinc.com/header.css*/
@OrigamiTech
OrigamiTech / Epic if statement
Created December 7, 2010 21:57
to detect if a character is a letter or not.
if ((((((((((((((((((((((((((((((((((((((((((((((((((((ch == 'A') | (ch == 'B')) | (ch == 'C')) | (ch == 'D')) | (ch == 'E')) | (ch == 'F')) | (ch == 'G')) | (ch == 'H')) | (ch == 'I')) | (ch == 'J')) | (ch == 'K')) | (ch == 'L')) | (ch == 'M')) | (ch == 'N')) | (ch == 'O')) | (ch == 'P')) | (ch == 'Q')) | (ch == 'R')) | (ch == 'S')) | (ch == 'T')) | (ch == 'U')) | (ch == 'V')) | (ch == 'W')) | (ch == 'X')) | (ch == 'Y')) | (ch == 'Z')) | (ch == 'a')) | (ch == 'b')) | (ch == 'c')) | (ch == 'd')) | (ch == 'e')) | (ch == 'f')) | (ch == 'g')) | (ch == 'h')) | (ch == 'i')) | (ch == 'j')) | (ch == 'k')) | (ch == 'l')) | (ch == 'm')) | (ch == 'n')) | (ch == 'o')) | (ch == 'p')) | (ch == 'q')) | (ch == 'r')) | (ch == 's')) | (ch == 't')) | (ch == 'u')) | (ch == 'v')) | (ch == 'w')) | (ch == 'x')) | (ch == 'y')) | (ch == 'z')) { /*code*/ }
string suffix(int n){return(n%10==1&&n%100!=11?"st":(n%10==2&&n%100!=12?"nd":(n%10==3&&n%100!=13?"rd":"th")));}
@OrigamiTech
OrigamiTech / KeyGenJukebox Downloader
Created January 3, 2011 16:14
Downloads all the music from keygenjukebox.com
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.IO;
namespace KGJ_DL
{
using System;using System.Runtime.InteropServices;
namespace BrainFrack{
class Program{
static unsafe void Main(string[]args){
string c=Console.ReadLine();
int s=30000;
byte* p=(byte*)Marshal.AllocCoTaskMem(s);
for(int i=0;i<s;i++)*p++=0;
p-=s;
Console.Clear();
@OrigamiTech
OrigamiTech / getPassword
Created January 22, 2011 21:46
Function to get password input from a CLI without displaying the password.
static string getPassword()
{
string Pass = "";
char c = Console.ReadKey(true).KeyChar;
while (c != (char)0x0D)
{
if (c == 0x08)
{
if (Pass.Length > 0)
{
@OrigamiTech
OrigamiTech / NotFile
Created January 26, 2011 18:49
Not every byte of a file, and reverse the filename.
using System;
using System.IO;
namespace NotFile
{
class Program
{
static void Main(string[] args)
{
foreach (string path in args)
@OrigamiTech
OrigamiTech / EveryIPv4
Created February 4, 2011 18:14
Dumps every IPv4 IP address to a text file.
using System;
using System.IO;
namespace EveryIPv4{
class Program{
static void Main(string[] args){
using(StreamWriter sw=new StreamWriter("dump.txt"))
for(uint u=uint.MinValue;u<=uint.MaxValue;u++)
for (byte b=0;b<4;b++)
sw.Write(((u>>((3-b)*8))&0xFF).ToString()+(b==3?'\n':'.'));
}
using System;
using System.IO;
namespace EveryIPv6
{
class Program
{
static void Main(string[] args)
{
using (StreamWriter sw = new StreamWriter("dump.txt"))
for (ulong u1 = ulong.MinValue; u1 <= ulong.MaxValue; u1++)