Skip to content

Instantly share code, notes, and snippets.

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
@luckydonald
luckydonald / answer.md
Last active Aug 21, 2021
How to get the hostnames and informations of other hosts in the same docker scale grouping. http://stackoverflow.com/a/39895650/3423324
View answer.md

The way I could do it was by using the docker api. I used the docker-py package to access it.

The api exposes a labels dictionary for each container, and the keys com.docker.compose.container-number, com.docker.compose.project and com.docker.compose.service did what was needed to build the hostname.

The code below is a simplified for code I am now using. You can find my advanced code with caching and fancy stuff that at Github at luckydonald/pbft/dockerus.ServiceInfos (backup at gist.github.com).

@luckydonald
luckydonald / Fallout 4 Save File Format.md
Created Apr 18, 2021 — forked from SirTony/Fallout 4 Save File Format.md
The binary format for Fallout 4 PC save files.
View Fallout 4 Save File Format.md

Fallout 4 Save File Format

The binary format for Fallout 4 PC save files. This document was created by reverse-engineering files from version 1.2.37.0 of the game.

Note: This document is incomplete!

Table of Contents

@luckydonald
luckydonald / cubietruck_wifi_bridge.md
Last active Mar 15, 2021
How I configure the Cubietruck to work as an WLAN bridge.
View cubietruck_wifi_bridge.md

In this file I document the steps taken to get the onboard wifi chip of the Cubietruck (Cubieboard 3) up and running.

Add the wifi driver to the modules to load on startup.

sudo nano /etc/modules

Now add at the end of the file, if not already in the list:

bcmdhd
View check_authorization.php
<?php
define('BOT_TOKEN', 'XXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXX'); // place bot token of your bot here
function checkTelegramAuthorization($auth_data) {
$check_hash = $auth_data['hash'];
unset($auth_data['hash']);
$data_check_arr = [];
foreach ($auth_data as $key => $value) {
$data_check_arr[] = $key . '=' . $value;
@luckydonald
luckydonald / cubietruck_gpio.md
Last active Feb 1, 2021
How to setup and use GPIO ports/pins on a Cubietruck
View cubietruck_gpio.md

Setup and use GPIOs on a Cubietruck

Cubietruck is also known as Cubieboard 3

Note: This file documents just what I did, first of all as a note for myself. So this is not primarily intended as a tutorial. Because it still might be helpfull, I uploaded it. The GPIO function is now confirmed to work, tested with my multimeter, but I am still waiting for my jumper cables to arrive, so I can use them securely.

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

View gist:a53178b2ee66dddf655143823e189d20
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 Mar 23, 2020
python style exception trace for PHP
View python_like_exception.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 Jun 11, 2019 — 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
View gist:cfde4c8107da30390b17ddc35b964f4a
class LoggerHook
{
private $CI;
function __construct()
{
$this->CI =& get_instance();
}
public function log()
{
@luckydonald
luckydonald / Pipboy Protocol.md
Last active Dec 13, 2018
Fallout 4 Protocol description
View Pipboy Protocol.md

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;
View part1.py
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