Skip to content

Instantly share code, notes, and snippets.

@urbanij
urbanij / gtkwave_macOS_cli_instructions.md
Created November 26, 2021 21:05
Invoke gtkwave from CLI on macOS (Catalina)

GTKWave from CLI on macOS (Catalina)

based on this article https://ughe.github.io/2018/11/06/gtkwave-osx (which does not work for me, as is)

  • Motivation

While installing and running GTKWave is straightforward on macOS, it is slightly more difficult to get the command line tool running properly:

$ /Applications/gtkwave.app/Contents/Resources/bin/gtkwave
Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.4 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /Applications/gtkwave.app/Contents/Resources/bin/gtkwave line 2.
@urbanij
urbanij / tabstospaces.py
Last active March 10, 2022 13:37
tabs to spaces
#!/usr/bin/env python
"""
convert tabs to spaces and also prune 0xa0 characters, if any.
https://gist.github.com/urbanij/3b295f72e191958c533683e798437a53
Sat Nov 13 18:13:11 CET 2021
----
Fri Mar 4 09:53:51 CET 2022
also remove trailing whitespaces:
"""

Installing cling (from source, on macOS) and connect it to Jupyter, without conda or xeus_cling

cd to local dev directory (could be anything)

cd Documents/dev

clone the repo

git clone https://github.com/root-project/cling.git
"""
Demo [em_waves](https://pypi.org/project/em-waves)
Running:
after installing em_waves with:
`pip3 install em_waves`
type:
`python3 em_waves_demo1.py`
"""
@urbanij
urbanij / INSTALL_macOS.md
Created October 25, 2020 09:18
Install and use qwt under macOS

Install and use qwt under macOS*:

After downloading it from here https://sourceforge.net/projects/qwt/:

cd qwt-6.1.5
mkdir build && cd build
qmake ..
make -j4
sudo make install # this command install stuff inside /usr/local/
@urbanij
urbanij / stalin_sort.cpp
Last active September 27, 2020 09:39
Stalin sort algorithm
/* Stalin sort algorithm
* @urbanij
* g++ -std=c++98 stalin_sort.cpp -o stalin_sort
*/
#include <iostream>
#include <time.h>
#define N 30
void populate_array(int* arr, int n) {
@urbanij
urbanij / 2N4957_Y_parameters.cpp
Last active June 13, 2020 08:08
Read 2N4957 pnp transistor Y parameters data in a single command.
/*********************************************************************************************
** **
** syRF <https://urbanij.github.io/syRF/> **
** Copyright (C) 2019-2020 Francesco Urbani **
** **
**********************************************************************************************
** Author: Francesco Urbani <https://urbanij.github.io/> **
** Date: Tue Apr 14 10:20:22 CEST 2020 **
** File: 2N4957_Y_parameters.h **
** **
@urbanij
urbanij / Editing-Sublime-snippets.md
Last active April 4, 2019 13:05
Editing Sublime Text snippet

Editing/adding snippet in Sublime Text

Editing snippet

  1. Move to the folder where the installed packages reside, i.e. /Applications/Sublime Text.app/Contents/MacOS/Packages. You can hop there either by typing: cd /Applications/Sublime Text.app/Contents/MacOS/Packages or from the Application folder: right click on Sublime Text -> Show Package Contents -> Contents -> MacOS -> Packages
@urbanij
urbanij / lut_7_seg_generator.py
Last active September 21, 2019 06:46
Lookup Table generator for 7-segment display (specifically for the 6 on-board on the Terasic DE10-Lite dev. board)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# ==========================================================
# LUT 7-segment generator
# for the Univeristy project G-Pong
# Fall 2018 -- Digital Design class
#
# Francesco Urbani
# Date: Fri Nov 30 10:38:59 CET 2018