Skip to content

Instantly share code, notes, and snippets.

View tuxdna's full-sized avatar

Saleem Ansari tuxdna

View GitHub Profile
@tuxdna
tuxdna / advice-ml-newbie.md
Last active November 20, 2023 13:19
Advice for Aspiring Machine Learning Engineers

Question:

Prompt: Hello, I study to become ML Engineer. As someone with your experience, what would be your advise to someone like me who wants to be in that field but doesn't have the background in it?

My Advice

Machine Learning is a very broad and deep field to study, which can take many years to learn. However I would advice you to start small. Given some data, can you find some insights from this data that are interesting, actionable, or simply support a story that you want to narrate? You can just use pen and paper, or Excel sheets to start with. I would suggest to use tools readily available online, and build working prototype -- a prototype that is maybe ugly but solves the problem quickly. Then keep digging deeper into how it works underneath.

Further, can you create a system, that periodically finds such insights, from such data that is updated over time? Interestingly you don't necessarily have to always build complex ML models to help end-users.

@tuxdna
tuxdna / convert.sh
Last active January 6, 2021 09:56
Downsize scanned PDF files for low space
# find the number of pages in pdf file
qpdf --show-npages file_name.pdf
# split into multiple pages using first-to-last range, where first page is 1 and last page is 4
pdftoppm -jpeg -f 1 -l 4 some-file.pdf p
# combine into single pdf
convert p-1.jpg p-2.jpg p-3.jpg p-4.jpg some-file-downsized.pdf
@tuxdna
tuxdna / ReactiveTest.java
Created December 8, 2020 13:27
RxFlowable wait for concurrent processing to finish
import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.core.Maybe;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Scheduler;
import io.reactivex.rxjava3.parallel.ParallelFlowable;
import io.reactivex.rxjava3.schedulers.Schedulers;
import org.apache.commons.lang3.tuple.ImmutablePair;
import java.time.LocalTime;
import java.util.concurrent.ExecutorService;
@tuxdna
tuxdna / README.md
Created August 25, 2019 20:05
How to play audio on multiple devices on your Ubuntu machine?

How to play audio on multiple devices on your Ubuntu machine?

List sources

$ pacmd list-sources |grep name:
	name: <bluez_sink.00_00_00_00_D2_89.a2dp_sink.monitor>
	name: <alsa_output.pci-0000_00_1f.3.analog-stereo.monitor>
@tuxdna
tuxdna / betareg.py
Created May 27, 2019 09:05 — forked from brentp/betareg.py
beta regression in statsmodels
# -*- coding: utf-8 -*-
u"""
Beta regression for modeling rates and proportions.
References
----------
Grün, Bettina, Ioannis Kosmidis, and Achim Zeileis. Extended beta regression
in R: Shaken, stirred, mixed, and partitioned. No. 2011-22. Working Papers in
Economics and Statistics, 2011.
@tuxdna
tuxdna / README.md
Created May 21, 2019 09:56
How to overcome Imbalanced Data when training ML Models?
@tuxdna
tuxdna / README.md
Created April 30, 2019 10:24
Convert hex data ( binary array ) back to floats in Java

Python Data:

Dimension: 2 x 768

[array([-7.3584e-01, -1.9531e-03, -6.8970e-03, -6.0303e-01, -2.1008e-01,
        -4.2114e-03,  2.0935e-02,  3.6157e-01, -1.7712e-01, -3.5449e-01,
        -4.4629e-01, -1.0791e-01,  2.7563e-01,  1.0791e-01, -3.0664e-01,
        -6.1676e-02, -2.9468e-01,  2.1594e-01, -1.3232e-01,  1.3171e-01,
        -4.1772e-01,  9.2346e-02, -4.5239e-01, -1.3147e-01,  2.9175e-01,
@tuxdna
tuxdna / crop-all.py
Created February 27, 2019 08:03
Python script to crop images
# find . -name "Screenshot*.png" -exec python3 crop-all.py "{}" \;
import sys
import os
import subprocess
top_left = (33, 213)
bot_right = (910, 780)
width = bot_right[0] - top_left[0]
@tuxdna
tuxdna / script.py
Last active January 27, 2019 08:45
Tensorflow example eval
import tensorflow as tf
tf.reset_default_graph()
s1 = tf.Session()
g = tf.get_default_graph()
foo_var = tf.Variable(42, name='foo')
assign_14 = foo_var.assign(14, name="assign_14")
assign_17 = foo_var.assign(17, name="assign_17")