Skip to content

Instantly share code, notes, and snippets.

View pelegm's full-sized avatar

Peleg Michaeli pelegm

View GitHub Profile
@pelegm
pelegm / memory
Created May 26, 2015 10:11
Show system memory
#!/bin/sh
sudo lshw -short -c memory
@pelegm
pelegm / kernel-version
Created May 26, 2015 10:10
kernel-version
#!/bin/sh
uname -r
@pelegm
pelegm / ldiff
Last active August 29, 2015 14:21
colorized unified paged diff
#!/bin/sh
diff -u $1 $2 |\
sed 's/^-/\x1b[31m-/;s/^+/\x1b[32m+/;s/^@/\x1b[34m@/;s/$/\x1b[0m/' |\
less
@pelegm
pelegm / ubuntu-codename
Created April 11, 2015 12:44
ubuntu-codename
#!/usr/bin/python
import lsb_release
print lsb_release.get_lsb_information()['CODENAME']
@pelegm
pelegm / ubuntu-architecture
Created April 11, 2015 12:42
ubuntu-architecture
## Credit: Cristiana Nicolae
## Source: http://askubuntu.com/a/352090/221347
getconf LONG_BIT
@pelegm
pelegm / ubuntu-description
Created April 11, 2015 12:38
ubuntu-description
#!/usr/bin/python
import lsb_release
print lsb_release.get_lsb_information()['DESCRIPTION']
@pelegm
pelegm / ubuntu-version
Last active August 29, 2015 14:18
ubuntu-version
#!/usr/bin/python
import lsb_release
print lsb_release.get_lsb_information()['RELEASE']
@pelegm
pelegm / bios-version
Created April 11, 2015 12:29
bios-version
## Credit: sdennie
## Source: http://ubuntuforums.org/showthread.php?t=857399&p=5371479#post5371479
sudo dmidecode -s bios-version
@pelegm
pelegm / git-repo-size
Created March 31, 2015 17:19
Get git repo size
# Credit: http://stackoverflow.com/a/8185326/1565828
git bundle create tmp.bundle --all && du -sh tmp.bundle && rm tmp.bundle
@pelegm
pelegm / round.go
Last active January 5, 2018 13:48 — forked from davidvthecoder/round.go
package main
import (
"log"
"math"
)
func Round(val float64, roundOn float64, places int ) (newVal float64) {
var round float64
pow := math.Pow(10, float64(places))