Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

mak iamaamir

🏠
Working from home
View GitHub Profile
View Batch rename.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from os import listdir, chdir, rename
# Valid chars in a file name
alpha = 'abcdefghijklmnopqrstuvwxyz0123456789.'
dir_path = "/home/varun/Desktop/Github Projects/CodeKata/Python"
@iamaamir
iamaamir / VetorsAndList.java
Last active Feb 3, 2018
Please write a program to use vector and list to store 10 integers in order (from smallest to largest). You need to find proper location using vector or list functions for each number added. Please do NOT use any sorting function. a. Generate 1 random integer between -100 and 100 and display it on screen b. Insert the number generated in step b …
View VetorsAndList.java
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Vector;
import java.util.stream.IntStream;
/*Please write a program to use vector and list to store 10 integers in order
(from smallest to largest).
You need to find proper location using vector or list functions for each number added.
@iamaamir
iamaamir / Postfix.java
Last active Feb 15, 2018
wap that reads postfix expressions and prints their values. Each input expression should be entered on its own line, and the program should terminate when the user enters a blank line. Please do error checking for any error.
View Postfix.java
import java.util.EmptyStackException;
import java.util.Scanner;
import java.util.Stack;
/*
wap that reads postfix expressions and prints their values.
Each input expression should be entered on its own line,
and the program should terminate when the user enters a blank line.
Please do error checking for any error.
View DecimalToBinary.java
import java.util.Scanner;
public class DecimalToBinary {
public static void main(String[] args) {
new DecimalToBinary().run();
}
public void toDecimal(int number){
int binary[] = new int[number];
@iamaamir
iamaamir / linkedlist.c
Created May 29, 2018
basic implementation of linkedlist in c
View linkedlist.c
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
// const
#define AtBeginning 1
#define AtEnd 0
struct Node
{
@iamaamir
iamaamir / timestamp.py
Created Oct 4, 2018
simple Sublime Text 3 plugin to insert Author with timestamp
View timestamp.py
import sublime, sublime_plugin
from time import localtime, strftime
class InsertDatetimeCommand(sublime_plugin.TextCommand):
def run(self, edit):
format = "%d/%b/%Y/(%I.%M:%p)"
current_date = strftime(format, localtime())
content = "Author: Aamir khan (aamirkhan180@gmail.com)\n{}\n".format(current_date)
sel = self.view.sel();
for s in sel:
if s.empty():
@iamaamir
iamaamir / post.php
Created Feb 14, 2019
add a subscriber to mailchimp
View post.php
<?php
if (isset($_POST['email'])) {
$email = $_POST['email'];
$template = strtr("{\"email_address\": \"%email%\",\"status\": \"subscribed\"}",
array('%email%' => $email));
$curl = curl_init();
@iamaamir
iamaamir / getFakeProfiles.js
Last active Feb 14, 2019
get some fake random user profiles
View getFakeProfiles.js
function getFakeProfiles(){
return fetch('https://randomuser.me/api')
.then(res => res.json())
.then(res =>res['results'][0])
.catch(e => e);
}
@iamaamir
iamaamir / helpers.js
Last active May 14, 2019
js helper functions
View helpers.js
// Date object to unix timestamp
function unix(date) {
return Math.round(date.getTime() / 1000);
}
// replace all from string
String.prototype.replaceAll = function(rgx, replacement) {
var self = this;
return self.replace(new RegExp(rgx, "g"), replacement);
};
View 10 Books to Learn Machine Learning.txt
1. Incognito by David Eagleman
2. How Smart Machines Think by Sean Gerrish
3. The Hundred-Page Machine Learning Book by Andriy Burkov
4. Python Machine Learning (2nd Edition) by Sebastian Rasckha & Vahid Mirjalili
5. Deep Learning by Andrew W. Trask
6. Bayesian Methods For Hackers by Cameron Davidson - Pilon
7. Doing Data Science by Cathy O'Neil & Rachel Schutt
8. Reinforcement Learning by Richard S. Sutton & Andrew G. Barto
9. The Book of Why by Judea Pearl & Dana Mackenzie
10. Quantum Machine Learning by Peter Wittek