$ wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.raw | |
$ qemu-system-x86_64 -M pc,accel=kvm -m 1G \ | |
-drive file=./debian-12-nocloud-amd64.raw,if=virtio \ | |
-netdev type=user,hostfwd=tcp::5573-:22,id=net0 \ | |
-device virtio-net,netdev=net0 -rtc base=localtime -smp 4 \ | |
-nographic | |
# login with user 'root' | |
VM$ apt update && apt install openssh-server | |
VM$ echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/root_login.conf | |
VM$ systemctl restart sshd |
#include <iostream> | |
#include <Windows.h> | |
int main() | |
{ | |
DWORD firmwareTableProviderSignature = 0x41435049; // "ACPI" | |
DWORD firmwareTableMSDMID = 0x4d44534d; // "MSDM" | |
UINT structSize = EnumSystemFirmwareTables(firmwareTableProviderSignature, NULL, 0); | |
if (structSize == 0) { |
Prior to
Bash 4.4
set -u
treated empty arrays as "unset", and terminates the process.
There are a number of possible workarounds using array
parameter expansion,
however almost all of them fail in certain Bash versions.
This gist is a supplement to this StackOverflow post.
# Authors: Mathieu Blondel, Vlad Niculae | |
# License: BSD 3 clause | |
import numpy as np | |
def _gen_pairs(gen, max_iter, max_inner, random_state, verbose): | |
rng = np.random.RandomState(random_state) | |
# if tuple, interpret as randn |
/* | |
MIT License | |
Copyright 2019 Foster T. Brereton | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and | |
associated documentation files (the "Software"), to deal in the Software without restriction, | |
including without limitation the rights to use, copy, modify, merge, publish, distribute, | |
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
createStrippedAndDebugInfo() { | |
cd ${REPO_PATH} # assuming we're in your repository's directory | |
ANDROID_NDK=<PATH_TO_NDK> | |
TMP_DIR_NAME=tmp_strip_symbols | |
AAR=`find -name '*.aar'` # find the path to the AAR containing the binaries | |
mkdir -p ${TMP_DIR_NAME} | |
try cd ${TMP_DIR_NAME} |
{ | |
// Use IntelliSense to learn about possible attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Debug-LLDB", | |
"type": "lldb", | |
"request": "launch", |
What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.
In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.
Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th