Skip to content

Instantly share code, notes, and snippets.

@hxmuller
hxmuller / program-spi-nor-with-raspi.md
Last active May 3, 2024 10:41
Program the SPI NOR flash on a Pinebook Pro using a Raspberry Pi

Program SPI NOR Flash on Pinebook Pro with a Raspberry Pi

TL;DR: This describes the process, hardware, and software used to perform in-circuit programming of the 128Mbit SPI NOR flash in the Pinebook Pro using a Raspberry Pi.

Warning

You, the user of this information bear ALL responsibility for ANY outcome of its use, whether negative or positive. My success in this operation can be attributed to the following factors:

  • Attention to detail
  • Curiousity
@xuesongbj
xuesongbj / inet_ntop and inet_pton example
Created May 15, 2019 09:03
inet_ntop and inet_pton example
// IPv6 demo of inet_ntop() and inet_pton()
// (basically the same except with a bunch of 6s thrown around)
struct sockaddr_in6 sa;
char str[INET6_ADDRSTRLEN];
// store this IP address in sa:
inet_pton(AF_INET6, "2001:db8:8714:3a90::12", &(sa.sin6_addr));
// now get it back and print it
@suyashdamle
suyashdamle / client.py
Created April 22, 2019 15:40
Joint UDP-TCP client-server programs in Python using Socket Programming
import socket
HOST = 'localhost' # The server's hostname or IP address
PORT = 64532 # The port used by the server
use_tcp = False
if not use_tcp:
################# UDP CLIENT ####################
@reinzor
reinzor / stream_example.md
Last active July 2, 2024 19:46
GStreamer UDP stream examples

MJPEG

Server (Ubuntu 16.04)

gst-launch-1.0 -v filesrc location= /home/rein/Videos/big_buck_bunny_720p_30mb_0_0.mp4 ! decodebin ! videoconvert ! jpegenc ! rtpjpegpay ! udpsink host=localhost port=5000

Client (Ubuntu 16.04)

@fortizc
fortizc / print_tst.py
Last active April 27, 2023 19:25
A very simple gst plugin in python
#!/usr/local/bin/python3
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# This is a modified version of https://github.com/GStreamer/gst-python/blob/master/examples/plugins/python/identity.py
import gi
gi.require_version("Gst", "1.0")
gi.require_version('GstBase', '1.0')
from gi.repository import Gst, GObject, GstBase
@engelmarkus
engelmarkus / gtkmm-example.cpp
Created May 18, 2016 22:31
Creating a window with gtkmm 3 and a glade description.
// g++ -std=c++14 -o gtkmm-example gtkmm-example.cpp `pkg-config --cflags --libs gtkmm-3.0`
#include <memory>
#include <gtkmm.h>
class MainWindow : public Gtk::ApplicationWindow {
public:
MainWindow(BaseObjectType* obj, Glib::RefPtr<Gtk::Builder> const& builder)
: Gtk::ApplicationWindow(obj)
, builder{builder}
@maddouri
maddouri / build-static-python.sh
Created December 6, 2015 22:42
A simple script that builds static versions of Python and LibPython using musl-libc
#!/bin/bash
# set -eux
# This a simple script that builds static versions of Python and LibPython using musl-libc
# Find the associated article at: http://general-purpose.io/2015/12/06/compiling-python-and-libpython-statically-using-musl-libc/
WORKING_DIR="/code/static-python"
MUSL_PREFIX="/code/static-python/musl"
PY_PREFIX="/code/static-python/python"
/*
* TOTP: Time-Based One-Time Password Algorithm
* Copyright (c) 2015, David M. Syzdek <david@syzdek.net>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
@waveform80
waveform80 / gist:3390484
Created August 19, 2012 00:12
GStreamer 1 image overlay on video
# Working (overlays image on videotestsrc)
gst-launch-1.0 videomixer name=mix ! videoconvert ! xvimagesink multifilesrc location="test.png" caps="image/png,framerate=0/1" ! pngdec ! imagefreeze ! alpha method=0 alpha=0.5 ! mix. videotestsrc ! "video/x-raw,format=AYUV,framerate=25/1,width=320,height=240" ! mix.
# Fails (attempts to overlay image on webcam source)
gst-launch-1.0 videomixer name=mix ! videoconvert ! xvimagesink multifilesrc location="test.png" caps="image/png,framerate=0/1" ! pngdec ! imagefreeze ! alpha method=0 alpha=0.5 ! mix. v4l2src device=/dev/video0 ! "video/x-raw,format=YUY2,width=320,height=240" ! videoconvert ! mix.
# Output of failing command:
cat << EOF
Setting pipeline to PAUSED ...
@austinmarton
austinmarton / linux_timerfd_example.c
Created July 13, 2012 09:23
Linux file descriptor timers example
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.