Skip to content

Instantly share code, notes, and snippets.

View mozammel's full-sized avatar

Mozammel Haque mozammel

View GitHub Profile
from datetime import datetime
from dateutil import relativedelta
# Assign your birth date and average life expectancy
birth_date = input("Enter your birth date (YYYY-MM-DD): ")
birth = datetime.strptime(birth_date, "%Y-%m-%d")
avg_life = 72
current = datetime.now()
@mozammel
mozammel / gist:e87a99353b35928ca51bccae26ccf698
Created July 18, 2019 14:27 — forked from bessarabov/gist:674ea13c77fc8128f24b5e3f53b7f094
One-liner to generate data shown in post 'At what time of day does famous programmers work?' — https://ivan.bessarabov.com/blog/famous-programmers-work-time
git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
@mozammel
mozammel / gist:4ae65c28a6f7ac247134ca5cbb47d15b
Created October 19, 2016 07:48
iTerm2 initial customization with oh-my-zsh
Fix my iterm2
#install zsh
brew install zsh
#change default shell to zsh
chsh -s $(which zsh)
#install oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@mozammel
mozammel / tomcat context xml jndi
Created December 24, 2014 10:15
jndi resource in tomcat context for database
<Resource name="jdbc/spring" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" username="dbuser"
password="dbpass" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/dbname" />
Making git forget about a file
http://stackoverflow.com/questions/1274057/making-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore
Others:
http://thelinell.com/2014/12/23/curated-git-links-of-2014/
@mozammel
mozammel / Fix mobile numbers in scientific notation
Created December 23, 2014 10:02
Fix mobile numbers in scientific notation on a mysql db
update user_profile set mobileno=substring_index(mobileno, 'E', 1)*pow(10,substring_index(mobileno, 'E', -1)) where mobileno like '%E%' AND id>1;
@mozammel
mozammel / create-table-notices
Created November 22, 2014 10:53
Spring Tutorial - Create Table Notices
CREATE TABLE `notices` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`email` varchar(60) NOT NULL,
`text` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;