Skip to content

Instantly share code, notes, and snippets.

View tuxdna's full-sized avatar

Saleem Ansari tuxdna

View GitHub Profile
@tuxdna
tuxdna / pi.py
Last active April 13, 2024 04:02
Policy Iteration in Python
#!/usr/bin/env python
# coding=utf-8
import numpy as np
"""
1: Procedure Policy_Iteration(S,A,P,R)
2: Inputs
3: S is the set of all states
4: A is the set of all actions
5: P is state transition function specifying P(s'|s,a)
@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 / README.md
Last active March 10, 2023 13:02
Git clone without deep history

Git references

Git clone without deep history

Git clone without deep history make cloning faster when we only need the latest code.

With full history

First run

@tuxdna
tuxdna / schema.xml
Last active February 10, 2023 11:03
Apache Solr sample schema configuration
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@tuxdna
tuxdna / WordCountAverage.java
Created May 28, 2013 15:33
Word Length Average Map-Reduce with out Combiner
package org.apache.hadoop.examples;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.Text;
@tuxdna
tuxdna / WordCountAverage.java
Last active May 14, 2021 10:14
Word Length Average Map-Reduce using a Combiner
package org.apache.hadoop.examples;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DoubleWritable;
@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>