Skip to content

Instantly share code, notes, and snippets.

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
@hansstimer
hansstimer / mkcard.sh
Created February 14, 2013 02:55 — forked from mattes/mkcard.sh
#!/bin/bash
# Quelle: http://omappedia.org/wiki/Minimal-FS_SD_Configuration, 06.06.2012
if [ ! "$1" = "/dev/sda" ] ; then
unset LANG
DRIVE=$1
if [ -b "$DRIVE" ] ; then
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
@hansstimer
hansstimer / iterateregex_example.sh
Created September 11, 2012 00:55
bash: iterate, and regex example
#!/bin/sh
set -o errexit
foo="a 1a b c d e"
bar="a b d e f g"
for x in $bar
do
if ! [[ "$foo" =~ (^|[[:blank:]])$x([[:blank:]]|$) ]]; then
echo $x
@hansstimer
hansstimer / rsasign.go
Created August 29, 2012 19:50
Go: rsa signpkcs1v15 signing
package main
import (
"bytes"
"crypto"
"crypto/rand"
"crypto/rsa"
"crypto/sha512"
"fmt"
)
@hansstimer
hansstimer / rsaencryption.go
Created August 29, 2012 19:45
Go: rsa public key encryption
package main
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/sha1"
"fmt"
)