mirror of https://github.com/nirenjan/dotfiles.git
				
				
				
			Move scripts to separate folder
						commit
						71e6bff038
					
				| 
						 | 
					@ -0,0 +1,19 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env python
 | 
				
			||||||
 | 
					""" Calculate the Julian Date """
 | 
				
			||||||
 | 
					# http://www.cs.utsa.edu/~cs1063/projects/Spring2011/Project1/jdn-explanation.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					t = time.gmtime()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					a = (14 - t.tm_mon) / 12
 | 
				
			||||||
 | 
					y = t.tm_year + 4800 - a
 | 
				
			||||||
 | 
					m = t.tm_mon + 12 * a - 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jdn = t.tm_mday + (153 * m + 2) / 5 + 365 * y +\
 | 
				
			||||||
 | 
					      y / 4 - y / 100 + y / 400 - 32045
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jd = jdn + (t.tm_hour - 12) / 24.0 + t.tm_min / 1440.0 + t.tm_sec / 86400
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print "%05.1f" % jd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,6 @@
 | 
				
			||||||
 | 
					#!/usr/bin/env python
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					print "%05.1f" % (time.time() / 31557.6)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					#!/usr/bin/perl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					my $trek_year;
 | 
				
			||||||
 | 
					my $sd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = 
 | 
				
			||||||
 | 
					    gmtime(time);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$trek_year = ($year - 70) * 1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$sd = ((($yday)*1000/365.25 + $trek_year));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					printf "%.1f\n", $sd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue