Skip to content

Instantly share code, notes, and snippets.

View atiti's full-sized avatar

Attila Sukosd atiti

View GitHub Profile
#!/bin/bash
#
# LYWSD03MMC read out temperature & humidity
# report it to Home Assistant as a new sensor over MQTT
#
# 1. Setup the MAC address (hcitool lescan if you don't know) and MQTTT parameters
# 2. Initialize the MQTT structure: ./push-to-ha.sh init
# 3. Send in the reading: ./push-to-ha.sh
#
# Setup a periodic cron job -> profit!
@atiti
atiti / um25c.py
Created November 20, 2020 14:14
Quick python script to dump data from UM25C
#!/usr/bin/python3
import sys, signal, traceback, serial, time
def signal_handler(sig, frame):
global ser
print('Ctrl-C, quitting.')
if ser:
ser.close()
@atiti
atiti / hp1920-get-config.sh
Last active January 12, 2024 15:20
Download running config from a HP 1920S switch
#!/bin/bash
#
# Simple script to download the running configuration from the HP 1920S switch
# through the HTTP "APIs"
#
# Run it as:
# $ ./hp1920-getconfig.sh --host="10.1.2.3" --user="admin" --pass="hello" --file=startup-config
#
# Attila Sukosd <[email protected]>
#
@atiti
atiti / gist:2185884d71ddba8a050a30074676de2f
Created March 28, 2017 13:38
Measure CPU and Mem usage of a process
#!/bin/bash
PID=$1
while [ 1 ]; do
ps -q $PID -eo %cpu,%mem |tail -n1 >> process.log
sleep 0.1;
done
Your code looks reasonable to me. Any chance you could throw a binary and a couple of instructions onto github or similar so I can give it a quick test and see what state the GPU is in?
Also have you tried sudo vcdbg log msg to see if there are any useful messages logged by the GPU? If you do sudo vcgencmd set_logging level=0xc0 first, then you should get all the logging from the IL components that's going.
http://www.raspberrypi.org/forums/viewtopic.php?f=38&t=81310
CGDirectDisplayID display[32];
uint32_t displayCount = 0;
CGGetActiveDisplayList(32, display, &displayCount);
for(int i = 0; i < displayCount; i++) {
io_service_t service = CGDisplayIOServicePort(display[i]);
CFStringRef nameRef = IORegistryEntryCreateCFProperty(service, CFSTR("CFBundleIdentifier"), kCFAllocatorDefault, 0);
if(CFStringCompare(nameRef, CFSTR("info.ennowelbers.framebuffer"), 0)==0) {
// success! - display[i] is the display using the proxy framebuffer
}
}
#include <stdio.h>
int main(int argc, const char *argv[]) {
char buffer[512], found = 0;
for(int i=0;i<argc;i++)
if (strcmp(argv[i], "-Wabc") == 0) { found = 1; break; }
if (!found) return 1;
while (!feof(stdin)) {
int bytes = fread(buffer, sizeof(char), 512, stdin);
fwrite(buffer, sizeof(char), bytes, stdout);
fflush(stdout);
@atiti
atiti / libvpu_encode.c
Created March 31, 2014 06:37
IMX6 VPU Encode
// From https://raw.githubusercontent.com/ahmedammar/imx-testing-apps-misc/master/libvpu_encode.c
include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <fcntl.h> /* fcntl */
#include <sys/mman.h> /* mmap */
#include <sys/ioctl.h> /* fopen/fread */
#include "vpu_io.h"
#!/bin/sh
# Stash uncommited changes
git stash -q --keep-index
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
set syntax=on
set tabstop=4
set shiftwidth=4
set expandtab