Skip to content

Instantly share code, notes, and snippets.

View luckydonald's full-sized avatar
👀
294 people are currently looking at this profile

Luckydonald luckydonald

👀
294 people are currently looking at this profile
  • Some basement in Equestria.
View GitHub Profile
extern crate hyper;
extern crate url;
static HOST: &'static str = "www.google.com";
macro_rules! ret_err(
($e:expr) => {{
match $e {
Ok(v) => v,
Err(e) => { println!("Line {}: {}", line!(), e); return; }
@luckydonald
luckydonald / python_like_exception.php
Last active March 23, 2020 21:20
python style exception trace for PHP
static function python_like_exception(
Throwable $e, bool $skip_seen = true, ?array $seen = null
): string {
if ($skip_seen && !$seen) {
$seen = array();
}
$prev = $e->getPrevious();
if ($prev) {
$result[] = self::python_like_exception($prev, $skip_seen, $seen);
$result[] = "\nDuring handling of the above exception, another exception occurred:\n";
@luckydonald
luckydonald / gist:cfde4c8107da30390b17ddc35b964f4a
Created June 11, 2019 13:54 — forked from nerones/gist:6778719
An easy way to log session data and queries with Monolog and Hooks in codeigniter. Some of the code is taken from Profiler class in the core of CI. The hook must be post_controller or post_system
class LoggerHook
{
private $CI;
function __construct()
{
$this->CI =& get_instance();
}
public function log()
{
@luckydonald
luckydonald / Pipboy Protocol.md
Last active December 13, 2018 01:41
Fallout 4 Protocol description

luckydonald/JavaPipBoyServer/PROTOCOL.md Now summarizes this and other findings, and is generally more maintainend.

C Structs

struct Entry {
  uint8_t type;
  uint32_t id;
  switch (type) {
    case 0:
      uint8_t boolean;
def num(n):
string = ["", "", ""]
for d in str(int(n)):
for i, l in enumerate(digit(int(d)).split("\n")):
string[i] += l
# end for
# end for
return "\n".join(string)
# end def
@luckydonald
luckydonald / function.cast.php
Created July 23, 2018 21:14 — forked from borzilleri/function.cast.php
PHP function to cast an object from one class to another.
<?php
/**
* Cast an object into a different class.
*
* Currently this only supports casting DOWN the inheritance chain,
* that is, an object may only be cast into a class if that class
* is a descendant of the object's current class.
*
* This is mostly to avoid potentially losing data by casting across
* incompatable classes.
<html>
<head>
<title>Test</title>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-title" content="something" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, height=device-height">
<style>
@luckydonald
luckydonald / diff.patch
Created March 4, 2018 11:46 — forked from strazzere/diff.patch
rsakeyfinder
[35%]tstrazzere@bebop:[rsakeyfind] $ diff rsakeyfind.cpp-fixed rsakeyfind/rsakeyfind.cpp-original
colordiff 1.0.10 (http://colordiff.sourceforge.net/)
(C)2002-2012 Dave Ewart, davee@sungate.co.uk
4,5d3
<
< #include <unistd.h>
8a7
> #include <fcntl.h>
Hier die Schritte zum Installieren/Compilieren:
0- Download
http://www.cygwin.com/
Download > Richtige Version (meist 64 Bit)
https://cygwin.com/setup-x86.exe
Dann kann schon mal mit SChritt (1) gestartet werden.
http://web.stanford.edu/group/radar/softwareandlinks/sw/snaphu/
@luckydonald
luckydonald / cubietruck_shairport-sync.md
Last active December 1, 2016 16:33
How to install an Airplay server (shairport-sync) on a Cubietruck

Install Shairport-Sync on a Cubieboard

I did the steps in this Cubietruck GPIO tutorial before, so I might miss dependencies already installed there. If that is the case, bug me in a comment.

Licensed under a Luna-Will-Cry-If-You-Modify-Or-Redistribute-This 1.0 licence.

Install dependencies

source

sudo apt-get install -y autoconf libtool libdaemon-dev libasound2-dev libpopt-dev avahi-daemon libavahi-client-dev libssl-dev git
sudo apt-get install -y libsoxr-dev