Possibly the worst way to encode json in C?
% emcc example.c -o example.js -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$UTF8ToString,$stringToNewUTF8
% node example.js
JSON: {"name":"Captain Pants","id":0}
Possibly the worst way to encode json in C?
% emcc example.c -o example.js -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE='$UTF8ToString,$stringToNewUTF8
% node example.js
JSON: {"name":"Captain Pants","id":0}
# 'gem list -i foo' will print 'true' if a gem is already installed. 'false' otherwise | |
GEMS=clamp rake | |
# From the GEMS list, generate a list of make targets | |
TARGETS=$(foreach gem,$(GEMS),gem-$(shell gem list -i $(gem))-$(gem)) | |
build: $(TARGETS) | |
build: | |
@echo "=> OK to build" |
const { DeviceDiscovery } = require('sonos'); | |
DeviceDiscovery((device) => { | |
//console.log('found device at ' + device.host + " - " + device.friendlyName) | |
device.deviceDescription().then(descr => { | |
// look for a sonos named "Sonos Roam" | |
if (descr.friendlyName.match(/Sonos Roam/)) { | |
console.log(descr); | |
// Coheed - Vaxis II - first track |
Sometimes tar files have tar files, and it might be nice to read the contents of some files several layers deep. Here's how we can do it with Ruby and Python3 with no external dependencies.
We can create a layered tar file (a tar file containing other tar files) using docker save
or podman save
% podman save fpm-ubuntu-18.04 -o test.tar
--version 1.2.3.4 |
[Unit] | |
Description=no description given | |
[Service] | |
Type=simple | |
User=root | |
Group=root | |
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist. | |
# Prefixing the path with '-' makes it try to load, but if the file doesn't | |
# exist, it continues onward. |
#include <X11/Xlib.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
int main() { | |
Display *dpy; | |
// Below here, Copilot generated the rest. | |
dpy = XOpenDisplay(NULL); | |
if (dpy == NULL) { |
% git clone --depth 1 https://github.com/home-assistant/core
% grep -l climate */const.py | awk -F/ '{print $1}' | xargs -n1 sh -c 'jq .iot_class $1/manifest.json | grep -q local && echo "* https://www.home-assistant.io/integrations/$1"' -
% gcc main.c $(pkg-config --libs x11 xi --cflags) -o xinput-example | |
% ./xinput-example | |
Pointer id:2 at location 1011,756 |