Skip to content

Instantly share code, notes, and snippets.

@AyrA
AyrA / http.ps1
Last active April 13, 2024 14:21
Powershell HTTP Server
# Portable HTTP file server
# Should be somewhat safe but please don't actually use it.
# You can't exit this with CTRL+C directly and need to use the shutdown command below a directory listing,
# or you can kill the powershell process of course, but this causes the port to stay used sometimes.
# Features
# - Directory Browser
# - Can handle UTF8 URLs
# - Delivers unknown file types
# - /../ attack prevention
😀😃😄😁😆😅🤣😂🙂🙃🫠😉😊😇🥰😍🤩😘😗☺️☺😚😙🥲😋😛😜🤪😝🤑🤗🤭🫢🫣🤫🤔🫡🤐🤨😐😑😶🫥😶‍🌫️😶‍🌫😏😒🙄😬😮‍💨🤥🫨😌😔😪🤤😴😷🤒🤕🤢🤮🤧🥵🥶🥴😵😵‍💫🤯🤠🥳🥸😎🤓🧐😕🫤😟🙁☹️☹😮😯😲😳🥺🥹😦😧😨😰😥😢😭😱😖😣😞😓😩😫🥱😤😡😠🤬😈👿💀☠️☠💩🤡👹👺👻👽👾🤖😺😸😹😻😼😽🙀😿😾🙈🙉🙊💌💘💝💖💗💓💞💕💟❣️❣💔❤️‍🔥❤‍🔥❤️‍🩹❤‍🩹❤️❤🩷🧡💛💚💙🩵💜🤎🖤🩶🤍💋💯💢💥💫💦💨🕳️🕳💬👁️‍🗨️👁‍🗨️👁️‍🗨👁‍🗨🗨️🗨🗯️🗯💭💤👋👋🏻👋🏼👋🏽👋🏾👋🏿🤚🤚🏻🤚🏼🤚🏽🤚🏾🤚🏿🖐️🖐🖐🏻🖐🏼🖐🏽🖐🏾🖐🏿✋✋🏻✋🏼✋🏽✋🏾✋🏿🖖🖖🏻🖖🏼🖖🏽🖖🏾🖖🏿🫱🫱🏻🫱🏼🫱🏽🫱🏾🫱🏿🫲🫲🏻🫲🏼🫲🏽🫲🏾🫲🏿🫳🫳🏻🫳🏼🫳🏽🫳🏾🫳🏿🫴🫴🏻🫴🏼🫴🏽🫴🏾🫴🏿🫷🫷🏻🫷🏼🫷🏽🫷🏾🫷🏿🫸🫸🏻🫸🏼🫸🏽🫸🏾🫸🏿👌👌🏻👌🏼👌🏽👌🏾👌🏿🤌🤌🏻🤌🏼🤌🏽🤌🏾🤌🏿🤏🤏🏻🤏🏼🤏🏽🤏🏾🤏🏿✌️✌✌🏻✌🏼✌🏽✌🏾✌🏿🤞🤞🏻🤞🏼🤞🏽🤞🏾🤞🏿🫰🫰🏻🫰🏼🫰🏽🫰🏾🫰🏿🤟🤟🏻🤟🏼🤟🏽🤟🏾🤟🏿🤘🤘🏻🤘🏼🤘🏽🤘🏾🤘🏿🤙🤙🏻🤙🏼🤙🏽🤙🏾🤙🏿👈👈🏻👈🏼👈🏽👈🏾👈🏿👉👉🏻👉🏼👉🏽👉🏾👉🏿👆👆🏻👆🏼👆🏽👆🏾👆🏿🖕🖕🏻🖕🏼🖕🏽🖕🏾🖕🏿👇👇🏻👇🏼👇🏽👇🏾👇🏿☝️☝☝🏻☝🏼☝🏽☝🏾☝🏿🫵🫵🏻🫵🏼🫵🏽🫵🏾🫵🏿👍👍🏻👍🏼👍🏽👍🏾👍🏿👎👎🏻👎🏼👎🏽👎🏾👎🏿✊✊🏻✊🏼✊🏽✊🏾✊🏿👊👊🏻👊🏼👊🏽👊🏾👊🏿🤛🤛🏻🤛🏼🤛🏽🤛🏾🤛🏿🤜🤜🏻🤜🏼🤜🏽🤜🏾🤜🏿👏👏🏻👏🏼👏🏽👏🏾👏🏿🙌🙌🏻🙌🏼🙌🏽🙌🏾🙌🏿🫶🫶🏻🫶🏼🫶🏽🫶🏾🫶🏿👐👐🏻👐🏼👐🏽👐🏾👐🏿🤲🤲🏻🤲🏼🤲🏽🤲🏾🤲🏿🤝🤝🏻🤝🏼🤝🏽🤝🏾🤝🏿🫱🏻‍🫲🏼🫱🏻‍🫲🏽🫱🏻‍🫲🏾🫱🏻‍🫲🏿🫱🏼‍🫲🏻🫱🏼‍🫲🏽🫱🏼‍🫲🏾🫱🏼‍🫲🏿🫱🏽‍🫲🏻🫱🏽‍🫲🏼🫱🏽‍🫲🏾🫱🏽‍🫲🏿🫱🏾‍🫲🏻🫱🏾‍🫲🏼🫱🏾‍🫲🏽🫱🏾‍🫲🏿🫱🏿‍🫲🏻🫱🏿‍🫲🏼🫱🏿‍🫲🏽🫱🏿‍🫲🏾🙏🙏🏻🙏🏼🙏🏽🙏🏾🙏🏿✍️✍✍🏻✍🏼✍🏽✍🏾✍🏿💅💅🏻💅🏼💅🏽💅🏾💅🏿🤳🤳🏻🤳🏼🤳🏽🤳🏾🤳🏿💪💪🏻💪🏼💪🏽💪🏾💪🏿🦾🦿🦵🦵🏻🦵🏼🦵🏽🦵🏾🦵🏿🦶🦶🏻🦶🏼🦶🏽🦶🏾🦶🏿👂👂🏻👂🏼👂🏽👂🏾👂🏿🦻🦻🏻🦻🏼🦻🏽🦻🏾🦻🏿👃👃🏻👃🏼👃🏽👃🏾👃🏿🧠🫀🫁🦷🦴👀👁️👁👅👄🫦👶👶🏻👶🏼👶🏽👶🏾👶🏿🧒🧒🏻🧒🏼🧒🏽🧒🏾🧒🏿👦👦🏻👦🏼👦🏽👦🏾👦🏿👧👧🏻👧🏼👧🏽👧🏾👧🏿🧑🧑🏻🧑🏼🧑🏽🧑🏾🧑🏿👱👱🏻👱🏼👱🏽👱🏾👱🏿👨👨🏻👨🏼👨🏽👨🏾👨🏿🧔🧔🏻🧔🏼🧔🏽🧔🏾🧔🏿🧔‍♂️🧔‍♂🧔🏻‍♂️🧔🏻‍♂🧔🏼‍♂️🧔🏼‍♂🧔🏽‍♂️🧔🏽‍♂🧔🏾‍♂️🧔🏾‍♂🧔🏿‍♂️🧔🏿‍♂🧔‍♀️
@AyrA
AyrA / WindowedStream.cs
Created March 10, 2023 18:12
Stream that is a window of a bigger stream. Allows to only give parts of a stream to a component
using System;
using System.IO;
namespace AyrA.IO
{
public class WindowedStream : Stream
{
public override bool CanRead => baseStream.CanRead;
public override bool CanSeek => baseStream.CanSeek;
@AyrA
AyrA / TTT.cs
Last active October 16, 2021 04:04
#define TTT_USELINQ //If you feel that Linq is cheating, you can remove this line.
using System;
#if TTT_USELINQ
using System.Linq;
#endif
namespace UglyRestrictions
{
/// <summary>
@AyrA
AyrA / trycopy.php
Created June 16, 2021 09:45
Copy of 4GB+ files failes with PHP on Windows even if FS is NTFS and PHP is 64 bit.
<?php
//Both files must be on an NTFS volume. You may use the same volume.
$src='C:/temp/long.bin';
$dst='D:/temp/long.bin';
define('SIZE_4G',0x100000000);
//Create large file with mostly zeros but random content at the end
function create_file($src){
@unlink($src);
echo 'Creating sparse via fsutil...';
@AyrA
AyrA / bfjsf.js
Last active October 24, 2020 15:07
Brainfuck interpreter in JSFuck
//Brainfuck Interpreter in JSFuck by /u/AyrA_ch
(typeof(window)==="undefined"?global:window).bf=
//Put your code in the line below
'-[----->+<]>----.-[--->++<]>+.-[++>---<]>+.---[-->+++<]>-.----[->++<]>-.-------.+[->+++++<]>++.-[-->+++<]>-.++++.+++++.';
/*
Text input is done using 'prompt' function
Text output is shown at the end of the script, because console.log adds linebreaks
The interpreter has 1000000 bytes of memory
@AyrA
AyrA / GetWindowInfoEnum.cs
Created January 24, 2019 21:46
Flags for GetWindowInfo
//These are for the dwStyle and dwExStyle of WINDOWINFO
[Flags]
public enum WindowStyle : uint
{
/// <summary>
/// The window is an overlapped window.
/// An overlapped window has a title bar and a border.
/// Same as the WS_OVERLAPPED style.
/// </summary>
WS_TILED = 0x0,
@AyrA
AyrA / konami.js
Created July 8, 2018 02:57
JS Konami code script
//Small konami code script that doesn't uses the usual method of an integer array
//Either run this through a minifier or remove the comments,
//otherwise people can just search for "konami" or variable name combinations
//The string of the konami code itself is almost impossible to find by using search engines.
//Params:
//cb - required(function), called on complete sequence with all 3 parameters
//check - optional(function), checks if key presses should be evaluated, called with all 3 parameters.
//single - optional(bool), if set to something that evaluates to 'true' the secret can only be used once.
(function (cb, check, single) {
var d = "&&((%'%'BA";
@AyrA
AyrA / manual_windows_update.md
Created October 30, 2017 02:58
How to get manual Updates back in Windows 8 and later

Create the two files below. Keep whitespace as is. You can now use the Task scheduler (taskschd.msc) to create an update schedule that fits your computer usage. Microsoft usually publishes updates on the second tuesday of every month unless they are extremely critical. The files need to be run with administrative privileges.

stop_update.bat

net stop wuauserv
sc config wuauserv start= disabled
@AyrA
AyrA / KDF.cs
Created February 20, 2018 07:45
C# Custom Key derivation
using System;
using System.Linq;
using System.Security.Cryptography;
/*
I am in no way claiming that this is secure.
It merely serves as an example on how a key derivation function could work.
Features: