Skip to content

Instantly share code, notes, and snippets.

@buxtonpaul
buxtonpaul / wsldisplay.py
Created May 14, 2020
Quick'n'dirty python script to create the display variable for use with WSL2
View wsldisplay.py
#!/usr/bin/python3
import os
for line in os.popen('ipconfig.exe'):
if not line[0] in [' ', '\n']:
current_section = line
active = False
if 'Link-local IPv6 Address' in line:
active = True
@buxtonpaul
buxtonpaul / qtbase_i686-w64-mingw32.shared.posix.dw2
Created Aug 23, 2019
qtbase_i686-w64-mingw32.shared.posix.dw2
View qtbase_i686-w64-mingw32.shared.posix.dw2
This file has been truncated, but you can view the full file.
make[1]: Entering directory '/home/paul/src/mxe'
uname -a
Linux paul-gpu 4.15.0-58-generic #64~16.04.1-Ubuntu SMP Wed Aug 7 14:10:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
git log --pretty=tformat:"%H - %s [%ar] [%d]" -1
1b81e99cf78df3b0f89173d6f1bc71159cf190ca - Update packages.json & build-matrix.html [2 days ago] [ (HEAD -> master, origin/master, origin/HEAD)]
lsb_release -a 2>/dev/null || sw_vers 2>/dev/null || true
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
@buxtonpaul
buxtonpaul / for-each.htm
Last active Nov 27, 2018 — forked from bennadel/for-each.htm
Mutating An Array During .forEach() Iteration In JavaScript
View for-each.htm
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>
Mutating An Array During .forEach() Iteration In JavaScript
</title>
</head>
<body>
@buxtonpaul
buxtonpaul / readbinaryfloats.cpp
Created May 1, 2018
Quick function to read a binary file into a vector
View readbinaryfloats.cpp
template <class T>
std::vector<T> readFile(const char *filename)
{
std::vector<T> results;
std::ifstream fin(filename, std::ios::binary);
T n;
while (fin.read(reinterpret_cast<char *>(&n), sizeof(T)))
results.push_back(n);
return results;
}
@buxtonpaul
buxtonpaul / beegee.sh
Created Jan 9, 2018
Stay alive bash script. Runs until it sees a file ~/aah.txt, checking every 5 secs
View beegee.sh
#!/bin/bash
# loop checking for a file, if the file exists exit
for (( ; ; ))
do
if [ -f ~/aah.txt ]; then
#echo "File Found!"
exit
fi
sleep 5
View convertraw.py
import numpy as np
import matplotlib.pyplot as plt
import scipy.misc
import png
#import pil
import matplotlib.image as mpimg
def write_pgm(image, filename):
View sensescroll.py
from sense_hat import SenseHat
sense = SenseHat()
r = (255, 0, 0)
o = (255, 127, 0)
y = (255, 255, 0)
g = (0, 255, 0)
b = (0, 0, 255)
i = (75, 0, 130)
@buxtonpaul
buxtonpaul / run.sh
Created Jun 19, 2017
Bash script to compile the producer code, create the fifo and run the producer and consumer together
View run.sh
#! /usr/bin/bash
gcc producer.c -o producer
mknod myfifo.txt p
python consumer.py <myfifo.txt &
./producer
rm myfifo.txt
@buxtonpaul
buxtonpaul / producer.c
Created Jun 19, 2017
Sample producer for mknod ipc
View producer.c
#include <stdio.h>
#include <unistd.h>
int main(int argc,char*argv)
{
FILE *fp;
int i;
fp=fopen("myfifo.txt","w");
@buxtonpaul
buxtonpaul / consumer.py
Created Jun 19, 2017
Sample python fifo consumer
View consumer.py
while True:
a=raw_input()
if not a:
continue
print a[::-1]
if a == "Hello 9":
break
You can’t perform that action at this time.