Skip to content

Instantly share code, notes, and snippets.

View MightyPork's full-sized avatar
🐶
meow

Ondřej Hruška MightyPork

🐶
meow
View GitHub Profile
<?php
dehexify("414D415A494E47");
hexify("If you can read this, you are not special. You just know ASCII.");
function dehexify($x) {
$buf='';
for ($i = 0; $i < strlen($x); $i++)
{
if ($x[$i] == ' ') {
<?php
dehexify("414D415A494E47");
hexify("Banana.");
function dehexify($x) {
echo implode('', array_map('chr', array_map('hexdec', explode(',', chunk_split($x, 2, ','))))) . "\n";
}
function hexify($x) {
@MightyPork
MightyPork / crc.php
Created October 18, 2015 14:17
Routine for signing and checking data with CRC
<?php
/** Get bit length */
function bl($gen)
{
return (int) log($gen, 2) + 1;
}
/** Compute CRC */
function crc($data, $test = false, $genpoly = 0b1011)
@MightyPork
MightyPork / permutations.php
Created October 20, 2015 15:05
String Permutation Generator
<?php
// Needs php 5.6!
function combinations($length = 3, $chars = "abc")
{
$p = array_fill(0, $length, 0); // counters
$opt_count = strlen($chars);
$iter_count = $opt_count ** $length;
for($i = 0; $i < $iter_count; $i++) {
@MightyPork
MightyPork / pac_cleanup.sh
Created November 4, 2015 22:36
Cleans pacman and yaourt package cache
#!/bin/bash
[[ `whoami` != "root" ]] && echo "Must be root." && exit 1
echo -e "\e[1;36mCleaning package caches\e[0m"
# All packages
paccache -r -k 3 -c /var/cache/pacman
paccache -r -k 2 -c /var/cache/makepkg
stream = new Stream
a = new Listener
b = new Listener
c = new Listener
stream.bind(a)
stream.bind(b)
stream.bind(c)
.db 0x41, CHAR_A
.db 0x88, CHAR_B
.db 0x8a, CHAR_C
.db 0x64, CHAR_D
.db 0x20, CHAR_E
.db 0x82, CHAR_F
.db 0x66, CHAR_G
.db 0x80, CHAR_H
.db 0x40, CHAR_I
.db 0x87, CHAR_J
<?php
$code = [
'A' => '01',
'B' => '1000',
'C' => '1010',
'D' => '100',
'E' => '0',
'F' => '0010',
'G' => '110',
#!/bin/bash
echo "BOOM!!!"
rm ./*
touch rubble shrapnel_1 shrapnel_2 shrapnel_3 crater
0x1ff80000 - aa 00 55 ff
0x1ff80004 - f8 00 07 ff
0x1ff80008 - 00 00 ff ff
0x1ff8000c - 00 00 ff ff
0x1ff80010 - 00 00 ff ff
0x1ff80014 - 00 00 ff ff
0x1ff80018 - 00 00 ff ff
0x1ff8001c - 00 00 ff ff
0x1ff80020 - 9a 94 65 6b
0x1ff80024 - 89 98 76 67