Something something __Py_UnixMain
_main
python.o
:
$ brew uninstall binutils
Error is:
/* | |
* Working integration of mqtt_cpp with producer thread. | |
* Having the worker thread started by the connack handler is recommended by the mqtt_cpp author. | |
* This program also demonstrates automatic disconnection by a timer, as well as handling disconnection by the broker. | |
* Additionally, a message can be sent to the 'quit' topic to initiate disconnection. | |
* | |
* E.g. | |
* $ mosquitto_pub -h localhost -t quit -m 1 | |
*/ |
#include <iostream> | |
#include <thread> | |
#include <chrono> | |
#include <boost/asio.hpp> | |
#include <mqtt_client_cpp.hpp> | |
struct App { | |
boost::asio::io_context ioc {}; | |
using client_t = decltype(MQTT_NS::make_sync_client(std::declval<boost::asio::io_context &>(), "", 0)); |
#include <iostream> | |
#include <thread> | |
#include <chrono> | |
#include <boost/asio.hpp> | |
#include <mqtt_client_cpp.hpp> | |
struct App { | |
boost::asio::io_context ioc {}; | |
using client_t = decltype(MQTT_NS::make_sync_client(std::declval<boost::asio::io_context &>(), "", 0)); |
#!/usr/bin/env python | |
""" | |
Deactivate ACPI devices that may cause hibernation to fail | |
""" | |
from dataclasses import dataclass | |
import subprocess | |
@dataclass |
#!/usr/bin/env python | |
# Python 3.x | |
import random | |
rolls = 5000 # the more results the better | |
scaling = 10 # scale the histogram to fit the screen | |
dice = (20,) # a single d20 | |
#dice = (6, 6) # two d6s |
#!/usr/bin/env python | |
# Store 32-bit floating point number within three 8bit channels of a 32-bit RGBA pixel. | |
# Only suitable for normalised input values in the range [0.0, 1.0). | |
# | |
# Refer: https://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/ | |
import numpy as np | |
def frac(x): | |
return x - np.floor(x) |
# Assumes in_txt was generated by `xxd -g1 in.bin > in.txt` | |
import csv | |
with open(in_txt) as fin, open(out_csv, 'w') as fout: | |
o=csv.writer(fout, quotechar='"', quoting=csv.QUOTE_ALL) | |
for line in fin: | |
row = line.rstrip('\n').split(sep=' ', maxsplit=17) | |
# remove one leading space from last item | |
row[-1] = row[-1][1:] |
#!/bin/bash | |
# Note: this removes all uncommitted changes and untracked files! | |
git clean -xfd | |
git submodule foreach --recursive git clean -xfd | |
git reset --hard | |
git submodule foreach --recursive git reset --hard | |
git submodule update --init --recursive |
import logging | |
import sys | |
def init_logging(name, log_level): | |
# install handlers for stdout (DEBUG, INFO) and stderr (WARNING, ERROR) | |
# http://stackoverflow.com/a/16066513/143397 | |
logger = logging.getLogger(name) | |
logger.setLevel(log_level) |