Skip to content

Instantly share code, notes, and snippets.

View jynik's full-sized avatar

Jon Szymaniak jynik

View GitHub Profile
@jynik
jynik / bladerf_dc_iq_corr.py
Last active April 16, 2023 23:18
bladeRF: manual DC Offset and IQ Imbalance correction
#!/usr/bin/python2
#!/usr/bin/env python2
#
# This script puts the bladeRF into an RF loopback mode, transmitting
# a vector at an offset from the RX frequency. The resulting image may be used
# to manually dial in RX-side IQ imbalance correction. Sliders to minimize the RX
# DC offset are also included.
#
# License: GPLv3
#
@jynik
jynik / cpu_performance.sh
Created April 1, 2014 04:18
Set all CPU frequency scaling governors to 'performance'
#!/bin/sh
#
# Set frequency scaling governer to 'performance' on all cores
set -e
GOVERNOR=performance
SYS_PATH=/sys/devices/system/cpu
for cpu in `ls $SYS_PATH | grep 'cpu[0-9]\+'`; do
CPU_SCALING_GOVERNOR=$SYS_PATH/$cpu/cpufreq/scaling_governor
current=`cat $CPU_SCALING_GOVERNOR`
echo "$cpu is currently '$current', setting to 'performance'"
@jynik
jynik / bladerf_build_all.sh
Created November 11, 2014 16:38
bladeRF: Perform debug and release builds with GCC and Clang
#!/bin/bash
set -e
readonly CLANG=/usr/bin/clang
readonly SCAN_BUILD_PATH=/usr/share/clang/scan-build/
readonly SCAN_BUILD=$SCANBUILD_PATH/scan-build
readonly CCC_ANALYZER=$SCAN_BUILD_PATH/ccc-analyzer
# $1 Name
# $2 Debug/Release
@jynik
jynik / bladeRF-versions
Created June 28, 2015 03:18
Print bladeRF library and device versions
#include <stdlib.h>
#include <stdio.h>
#include <libbladeRF.h>
int main(int argc, char *argv[])
{
int ret = 0;
int status;
struct bladerf *dev;
const char *dev_specifier = NULL;
@jynik
jynik / bladeRF-versions.mk
Created June 28, 2015 03:49
Makefile for bladeRF-versions, with cross-compiling options (via a Yocto build)
#
# Simple cross-compilation example for Yocto-based toolchains and bladeRF
#
# Host build:
# make
#
# Wandboard Quad build:
# PLATFORM=wandboard-quad YOCTO_BUILD_DIR=path/to/build/dir make
#
# Raspberry Pi 2 build:
@jynik
jynik / regfield.py
Last active October 22, 2015 19:24
Simple register field calculator
#!env python3
#
# Copyright (c) 2015 Jon Szymaniak <jon.szymaniak@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@jynik
jynik / carray.c
Created November 20, 2017 16:47
carray - Print a binary file as a C array
/*
* Print the contents of a binary file as a C array.
*
* SPDX License Identifier: MIT
* (C) 2017 Jon Szymaniak <jon.szymaniak@gmail.com>
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@jynik
jynik / ready_set_yocto.txt
Last active May 16, 2024 06:30
Ready, Set, Yocto! (v0.3) : A short guide to getting started with Yocto
================================================================================
Ready, Set, Yocto! (v0.3)
A short guide to getting started with Yocto
using YP Rocko 2.4 the Raspberry Pi
jynik
================================================================================
-------------------------------------------------
1. Intro
@jynik
jynik / md5sum-diff
Last active June 26, 2023 03:04
Compare two files containing (default) md5sum output and print results.
#!/usr/bin/env python3
#
# Copyright (C) 2018 Jon Szymaniak <jon.szymaniak@gmail.com>
# SPDX License Identifier: MIT
#
# Compare two files containing (default) md5sum output and print results.
#
################################################################################
__version__ = '0.1.1'
@jynik
jynik / rich_hexdump.py
Created May 28, 2020 03:32
Ugly colorized hexdump example
#!/usr/bin/env python3
"""
A simple hex dump example with colorized output.
Per request, the output is structured with ASCII aligned
with corresponding data bytes, rather than the canonical
style typically used in hex dumps (e.g. hexdump -C).
The colorization is performed in a second pass, rather than
during a single pass, just to separate the requested example