Skip to content

Instantly share code, notes, and snippets.

View agostini01's full-sized avatar

Nicolas Agostini agostini01

View GitHub Profile
#/bin/bash
set -o pipefail
set -e
# Verbose commands for now
set -x
# Check if the first argument is passed
if [ "$#" -eq 0 ]; then
@agostini01
agostini01 / parse-bib-file.py
Last active December 13, 2022 01:44
Python script to parse a .bib file and print its @Article and @inpreceedings entries in a human readable format
#!/usr/bin/python3
# Author: Nicolas Bohm Agostini
# Date: 2022-Dec-12
# Version: 1.1
# License: MIT
# Changelog:
# 1.1 - added alternative way of printing
# @brief: This script parses a bib file and prints it in a specific format

Links for Nisght tools and tutorials

Download center

Installing Nsight compute from command-line:

# Download .run file from website and accept the terms and conditions.
sudo ./nsight-compute-linux-2020.1.1.8-28506821.run --nox11
@agostini01
agostini01 / htop.strace
Created April 27, 2020 13:55
htop strace
241 execve("/usr/bin/htop", ["htop"], 0x7fffeaaf9b78 /* 24 vars */) = 0
241 brk(NULL) = 0x7fffd27d9000
241 arch_prctl(0x3001 /* ARCH_??? */, 0x7fffdaf59710) = -1 EINVAL (Invalid argument)
241 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
241 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
241 fstat(3, {st_mode=S_IFREG|0644, st_size=27438, ...}) = 0
241 mmap(NULL, 27438, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7facd63d6000
241 close(3) = 0
241 openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libncursesw.so.6", O_RDONLY|O_CLOEXEC) = 3
241 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\221\0\0\0\0\0\0"..., 832) = 832

Extracted with:

for var in synthesizer._model.model.all_vars:
    print('{:15} {} {}'.format(
        '{}'.format(var.get_shape().as_list()),
        var.dtype,
        var.name))
@agostini01
agostini01 / custom-op-tf2.md
Created December 3, 2019 16:26
Custom OP for tensorflow 2.0

I have been working on TF 2.0 and the custom op tutorial presented here does allow execution of the op.

This is mainly due to eager execution and different custom op handling.

In order to call a custom op in python one must:

Start docker image

docker pull tensorflow/tensorflow:nightly-custom-op-ubuntu16
#install ubuntu 18.04
apt update && apt dist-upgrade -y
apt install vim tmux htop git tree curl wget ctags linux-tools-common linux-tools-generic linux-tools-`uname -r` valgrind kcachegrind -y
# nvidia drivers
cd # changes to root's home folder
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
@agostini01
agostini01 / deabloating-xiaomi-9t.md
Last active February 28, 2021 14:34
Debloating Xiaomi 9t pro with ADB

You can remove these apps (or re-install them if needed) using the XIAOMI ADB/Fastboot Tools.

https://github.com/Saki-EU/XiaomiADBFastbootTools

Alternatively it is possible to use the commandline:

pm uninstall -k --user 0 com.mi.android.globalpersonalassistant
pm uninstall -k --user 0 com.xiaomi.mipicks
pm uninstall -k --user 0 com.android.browser
@agostini01
agostini01 / zedboard-connections.md
Last active September 18, 2019 19:35
We will go through the steps of communicating to a digilent Zedboard using the UART and the Ethernet port.

Connecting to the Zedboard

We will go through the steps of communicating to a digilent Zedboard using the UART and the Ethernet port.

This tutorial assumes that the zedboard SD card was flashed with the Xillinux distribution for Zynq-7000 EPP and the host system is running a ubuntu 14.04 or newer (tested on 16.04).

Using UART port

Connect the host (USB) to the zedboard's UART port (micro USB) and execute on the host:

@agostini01
agostini01 / perf-fp-counters
Last active August 8, 2019 20:37
How to get fp events and fp ops per second in skylake?
Followed this tutorial:
http://www.bnikolic.co.uk/blog/hpc-howto-measure-flops.html
Get the latest version of perfmon2/libpfm (h/t this developerworks article):
git clone git://perfmon2.git.sourceforge.net/gitroot/perfmon2/libpfm4
cd libpfm4