Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import sionna as sn
import tensorflow as tf
###
# System params
BATCH_SIZE = 1
q_mod = 2 # QPSK
@japm48
japm48 / cvc4_pysmt.py
Created March 22, 2022 02:07
7l7w - 3 colors solutions in SMT solvers
#!/usr/bin/env python3
# Installing CVC4's python bindings is a PITA, so we use the
# pysmt wrapper instead.
# Enum/Sum types not yet supported...
# https://github.com/pysmt/pysmt/issues/187
# https://github.com/pysmt/pysmt/issues/538
# This program is based on:
sepal_length sepal_width petal_length petal_width variety
5.1 3.5 1.4 .2 Setosa
4.9 3 1.4 .2 Setosa
4.7 3.2 1.3 .2 Setosa
4.6 3.1 1.5 .2 Setosa
5 3.6 1.4 .2 Setosa
5.4 3.9 1.7 .4 Setosa
4.6 3.4 1.4 .3 Setosa
5 3.4 1.5 .2 Setosa
4.4 2.9 1.4 .2 Setosa
...
-- ######################################################
-- # Gnuradio enabled components
-- ######################################################
-- * testing-support
-- * python-support
-- * post-install
-- * man-pages
-- * gnuradio-runtime
@japm48
japm48 / day19_snippet.py
Last active January 8, 2022 01:14
AoC'21 orientation generation
import numpy as np
import itertools
def gen_valid_orientations_data():
# Out of all 48 choices, half of them result in a right-handed system (right is right [in this context...])
# and the other half results in a left-handed system (wrong).
# We check this via cross product: Z axis should have the same orientation as X cross Y.
#
# We only keep right-handed ones.
@japm48
japm48 / lsusb.txt
Created January 3, 2022 00:19
lsusb orangecrab r0.2 85F
$ sudo lsusb -v -d 1209:5af0
Bus 003 Device 008: ID 1209:5af0 Generic OrangeCrab r0.2 DFU Bootloader v3.1-6-g62e92e2
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.01
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
@japm48
japm48 / aoc21_day15_broken.py
Last active December 16, 2021 22:45
Day 15
#!/usr/bin/env python3
import functools
import numpy as np
USE_EXAMPLE = False
example_data = '''\
1163751742
1381373672
--- 01_sigmf_core_generated.h 2021-10-17 15:28:31.000000000 +0200
+++ 02_sigmf_core_generated.h 2021-10-17 15:21:32.000000000 +0200
@@ -9,15 +9,19 @@
namespace core {
struct Global;
+struct GlobalBuilder;
struct GlobalT;
struct Capture;
@japm48
japm48 / PKGBUILD
Last active November 24, 2021 19:52
libsigmf-git workaround
# Maintainer: xiretza <xiretza+aur@xiretza.xyz>
_pkgname=libsigmf
pkgname=$_pkgname-git
pkgver=r15.d3e985d
pkgrel=1
pkgdesc="A header-only C++ library for working with SigMF metadata"
arch=(any)
url="https://github.com/deepsig/libsigmf"
license=('Apache')
depends=()
@japm48
japm48 / euclidean_gcd.py
Created August 28, 2021 19:21
Eclidean GCD in python
def euclidean_gcd(a, b):
while a != b:
if a > b:
a -= b
else:
b -= a
return a