Skip to content

Instantly share code, notes, and snippets.

View mahdavipanah's full-sized avatar
💻
Wired in

Hamid Mahdavi mahdavipanah

💻
Wired in
View GitHub Profile
@mahdavipanah
mahdavipanah / pylearn-sololearn.md
Last active August 28, 2016 13:15
My notes in learning python via sololearn.com

In except blocks, the raise statement can be used without arguments to re-raise whatever exception occurred.

try:
   num = 5 / 0
except:
   print('An error occurred')
   raise

The assert can take a second argument that is passed to the AssertionError raised if the assertion fails.

@mahdavipanah
mahdavipanah / simple-pagination.js
Last active July 23, 2016 16:42 — forked from kottenator/simple-pagination.js
Simple pagination algorithm
// Implementation in ES6
function pagination(c, m, delta) {
var current = c,
last = m,
left = current - delta,
right = current + delta,
range = [],
rangeWithDots = [],
l;
@mahdavipanah
mahdavipanah / fixbootsplash.sh
Last active April 23, 2016 20:36
Ubuntu After Installation Todos
#! /bin/bash
# Fix Ubuntu Plymouth Boot Splash
# if entry exists for $vt_handoff use sed to search and replace
# write to tmp file - move to original
checkVT=$(grep -c "\$vt_handoff" /boot/grub/grub.cfg)
if [ ! "$checkVT" -eq "0" ]
then
echo "> Found vt_handoff removing ..."