Skip to content

Instantly share code, notes, and snippets.

View tahmidsadik's full-sized avatar
🥼
Mad Scientist

Tahmid Sadik tahmidsadik

🥼
Mad Scientist
View GitHub Profile
@tahmidsadik
tahmidsadik / word_counter.rs
Created July 10, 2019 03:59
Serial word counter
use std::fs;
use std::path::{Path, PathBuf};
use std::collections::HashMap;
use std::fs::read_to_string;
fn main() -> Result<(), std::io::Error> {
let mut word_counts = HashMap::new();
let mut files: Vec<PathBuf> = vec!();
for entry in fs::read_dir("/mnt/c/Users/tahmi/source/repos/shopup-lite/server/controllers")? {
let p = entry?.path();
@tahmidsadik
tahmidsadik / deduplicate_numbers.cpp
Last active May 24, 2019 06:57
Deduplicating numbers in C++
#include <iostream>
int main()
{
int number_counts[100] = { 0 }; // initializing an array of 100 elements with all of their value set to zero
int input_nums[] = { 1, 4, 6, 3, 9, 6, 7, 2, 3, 6, 8, 7, 3, 5, 6 }; // the input array
// looping over the input array and incrementing the count of an input
for (int i: input_nums) {
number_counts[i] = number_counts[i] + 1;

Keybase proof

I hereby claim:

  • I am tahmidsadik112 on github.
  • I am tahmid (https://keybase.io/tahmid) on keybase.
  • I have a public key ASD9frxxJONMoLZaUmZE-kQGBHPcBFAV3rqGLe6bT1WVYAo

To claim this, I am signing this object:

@tahmidsadik
tahmidsadik / dumb-bst.js
Created July 25, 2018 08:36
Dumbed down binary search tree, with only insert operation :)
let tree = { root: { val: null, left: null,
right: null
}
};
const createEmptySubtree = () => ({ val: null, left: null, right: null });
const insert = (node, root) => {
console.log(`node: ${node}, root: ${root}`);
if (!root.val) {
@tahmidsadik
tahmidsadik / install-android-sdk-for-react-native.sh
Created April 3, 2018 06:40
Installing Android SDK for react-native without android-studio in arch
#!/bin/bash
yaourt -S android-sdk
export ANDROID_HOME=/opt/android-sdk
export PATH=$PATH:$ANDROID_HOME/tools/bin
touch ~/.android/repositories.cfg
# arch specific
# the sdk is installed in /opt and the user don't have permission
sudo sdkmanager "platforms;android-23" "build-tools;23.0.1" "add-ons;addon-google_apis-google-23"
@tahmidsadik
tahmidsadik / purgeAndroid.txt
Created September 19, 2015 18:47
How to completely remove Android Studio from Mac OS X
How to Completely Remove Android Studio
Execute these commands from the terminal
rm -Rf /Applications/Android\ Studio.app
rm -Rf ~/Library/Preferences/AndroidStudio*
rm ~/Library/Preferences/com.google.android.studio.plist
rm -Rf ~/Library/Application\ Support/AndroidStudio*
rm -Rf ~/Library/Logs/AndroidStudio*
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFF"
android:columnCount="3"
android:alignmentMode="alignMargins"
tools:context=".HomeActivity$HomeFragment">
@tahmidsadik
tahmidsadik / gist:49fadc74d8d2e09e09fb
Last active August 29, 2015 14:07
Extracts number from string and adds them up.
(use '[clojure.string :only (split)])
(def s "96h11k4959q615948s50922o38h1453ij38w73413d5577lzrqw3780b389750vf100zd29z73j5wh73l6965n85vm77cw10awrjr29265289222238n10013uk10062f9449acbhfgcm35j78q80")
(defn num-parser [ls]
(split ls #""))
(defn num? [x]
(if (= x "") false (number? (read-string x))))
(reduce +(map #(Integer/parseInt %)(filter num? (num-parser s))))