Skip to content

Instantly share code, notes, and snippets.

<!--
Before opening this file in a web-browser, do the following.
In the same directory as this file, create a new directory/folder called media.
In the "media" folder, put some video that you want to use in the demo as ubuntu.webm and ubuntu.mp4
Also place a tux.jpg image in the "media" folder to see examples of the poster-image section
-->
<!DOCTYPE html>
<html>
<head>
<title>Video Tags in HTML 5</title>
@nitstorm
nitstorm / vnStat Cheat Sheet
Last active December 16, 2015 15:58
A tiny reference sheet for some of the mainly used features of vnStat
Summaries:
vnstat -m #monthly summaries
vnstat -d #daily summaries (last 30 days)
vnstat -h #hourly summaries (last 24 hours)
Other views:
vnstat -w #weekly comparison (last 7 days, last week, current week)
vnstat -t #top 10 entries ever
Live View:
@nitstorm
nitstorm / sample-layout-introduction-to-xhtml.html
Last active December 20, 2015 17:59
The sample layout for the post "Introduction to XHTML"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> </title>
</head>
<body>
</body>
</html>
@nitstorm
nitstorm / roundoff_without_builtin.py
Last active December 21, 2015 13:59
A Python3 roundoff function without using the builtin round function (for the LTP skype group). Very amateurish code, doesn't have decimal precision)
def roundoff(number):
##Converts the float to int
whole = int(number)
##Gets the fractal part
frac=number-whole
##Checks the fractal, greater than or equal to 0.5, rounds it up to the next higher digit, else returns the same digit
if frac >= 0.5:
return whole+1
@nitstorm
nitstorm / cookie_monster.py
Last active January 1, 2016 15:59
The cookie monster program for the blog post - Understanding Looping @ http://nitstorm.github.io/blog/
@nitstorm
nitstorm / time.py
Created December 31, 2013 19:19
Nested loop example for the blog - http://nitstorm.github.io/blog/
hours = int(input("Please enter number of hours: "))
i = 1
total = 0
#Looping through total number of hours
while i<= hours:
# Setting iterator for minutes
j = 1
# Looping through each minute for current hour
@nitstorm
nitstorm / double_summation.py
Created December 31, 2013 19:55
Summation and Double Summation examples for the Loops post @ http://nitstorm.github.io/blog/
x = int(input("Enter x upper limit:"))
y = int(input("Enter y upper limit:"))
total = 0
i,j = 1,1
while i <= y:
while j <= x:
total = total + (x*y)
j += 1
i += 1
print total
"""
The Introduction to Statistics Wrapper provided by Udacity for their course - https://www.udacity.com/course/st101
"""
from matplotlib import pyplot
from numpy import arange
import bisect
def scatterplot(x,y):
pyplot.plot(x,y,'b.')
@nitstorm
nitstorm / jekyll_redirect_from_insert_text.sh
Last active August 29, 2015 13:57
A bash script that reads the filename and inserts the "redirect_from" variable in the new URL structure my blog uses (blog/YYYY/MM/DD/title.html -> blog/title/)
# Takes filename of the format YYYY-MM-DD-title-of-post.md as input.
# Adds the line - redirect_from: "blog/YYYY/MM/DD/title-of-post.html" as the second line of the file
#
#!/bin/bash
for file in $@; do
file_stripped="$( cut -d '.' -f 1 <<< "$file" )"
IFS='-' read -r year month date title <<< "$file_stripped"
redirect_url="/blog/$year/$month/$date/$title.html"
insert_text="redirect_from: \"$redirect_url\""

Keybase proof

I hereby claim:

  • I am nitstorm on github.
  • I am nitinvenkatesh (https://keybase.io/nitinvenkatesh) on keybase.
  • I have a public key whose fingerprint is 6684 0047 BA04 7A6E C68E 47F4 E556 E8D6 3805 4D64

To claim this, I am signing this object: