Skip to content

Instantly share code, notes, and snippets.



  • Switzerland
View GitHub Profile
AyrA / square.js
Created Oct 18, 2017
You no longer need an npm module to calculate squares of numbers
View square.js
//Calculates x² of an integer up to ±1 million
var square = (function () {
var s = "if(A==B){return C;}";
var func = "var A=Math.abs(D|0);";
for (var i = 0; i <= 1000000; i++) {
func += s.replace(/B/, i).replace(/C/, i * i);
return new Function("D", func + "return Infinity;");
AyrA /
Last active Oct 30, 2017
Fast Windows search

Put the 3 batch files somewhere on your Desktop.


Use this to create/renew the cache. Depending on the number of files on your drives and the number of drives this might run for a few minutes.

If you prefer it would not index certain drives, remove the letters from the list.


AyrA / guid.php
Last active Nov 1, 2017
PHP UUID Generator
View guid.php
//Generates cryptographically safe UUIDv4 (sometimes called GUID)
function guid()
$data[6]=chr(ord($data[6])&0x0f|0x40); //set version to 0100
$data[8]=chr(ord($data[8])&0x3f|0x80); //set bits 6-7 to 10
AyrA / BypassCmdGpo.bas
Created Nov 2, 2017
Bypass GPO Restriction on CMD.exe with Excel
View BypassCmdGpo.bas
Option Explicit
'Copyright 2017 /u/AyrA_ch
'Open Excel, Press ALT+F11, add new "module" (not Class module) and paste this entire code in it.
'To use you can either place a button on your excel sheet and hook up these functions to it
'Or you place the cursor inside the Button function you want to use and press F5
'After one successful launch you find the executable on your Desktop.
'You then no longer need this file.
AyrA / where.bat
Created Nov 2, 2017
where command on Windows
View where.bat
REM Store this anywhere in your PATH.
AyrA / collection_count.cs
Created Nov 13, 2017
Length of any Collection in C#
View collection_count.cs
//#mode simple
using System;
using System.Collections;
using System.IO;
//This is a joke. Don't use
public static int Main(string[] Args)
AyrA / search.js
Created Feb 18, 2018
Find and count multiple words on a website
View search.js
(function (x) {
var text = document.body.textContent;
return (v) {
var m = text.match(new RegExp("\\s(" + v + ")[\\s.,!?]", "gi"));
return m ? m.length : 0;
})(["add", "all", "your", "words", "here"]);
AyrA / KDF.cs
Created Feb 20, 2018
C# Custom Key derivation
View KDF.cs
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.
AyrA /
Created Oct 30, 2017
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.


net stop wuauserv
sc config wuauserv start= disabled
AyrA / konami.js
Created Jul 8, 2018
JS Konami code script
View konami.js
//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.
//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";
You can’t perform that action at this time.