Skip to content

Instantly share code, notes, and snippets.

@jcfr
jcfr / qVariantMapToSettings.cpp
Created July 9, 2012 18:36
Qt example illustrating how to write list of QVariantMap into a settings file.
// Qt includes
#include <QSettings>
#include <QVariantMap>
// STL includes
#include <cstdlib>
int main(int, char*[])
{
@leommoore
leommoore / file_magic_numbers.md
Last active July 25, 2024 20:01
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

@nickvandewiele
nickvandewiele / driver.py
Last active January 31, 2023 19:14
PyQT, pyqtgraph, and Cython
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
from window import CustomWindow
@darrenjs
darrenjs / ssl_server_nonblock.c
Last active July 17, 2024 01:30
OpenSSL example using memory BIO with non-blocking socket IO
/*
This file had now been added to the git repo
https://github.com/darrenjs/openssl_examples
... which also includes a non blocking client example.
-------------------------------------------------------------------------------
ssl_server_nonblock.c -- Copyright 2017 Darren Smith -- MIT license
@aelkz
aelkz / psensor-install-f28.sh
Created March 18, 2019 18:11 — forked from pgnunes/psensor-install-f28.sh
Install Psensor on Fedora 28
#/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Please run this script as root"
exit 1
fi
dnf install -y gcc wget gtk3-devel GConf2-devel cppcheck libatasmart-devel libcurl-devel json-c-devel libmicrohttpd-devel help2man libnotify-devel libgtop2-devel make
wget -O /tmp/psensor-last-stable.tar.gz http://wpitchoune.net/psensor/files/psensor-last-stable.tar.gz
tar -xf /tmp/psensor-last-stable.tar.gz -C /tmp
rm -rf /tmp/psensor-last-stable.tar.gz