Skip to content

Instantly share code, notes, and snippets.

View brownman's full-sized avatar

brownman brownman

  • self
  • israel
View GitHub Profile
alert(document.cookie)
alert(document.cookie)
@brownman
brownman / winusb.sh
Last active September 7, 2015 10:06
Script creates bootable usb from windows iso, tested on Ubuntu 15.04 with Windows 8 and Windows 10 iso files on BIOS and UEFI machines.
#!/bin/sh
# Requirements:
# parted - to make gpt and partion
# sfdisk - to make mbr and partition over gpt
# blkid - to get UUID of partition for grub
# grub-pc-bin - files to install grub from UEFI-booted machines to MBR
usb="/dev/sdX" # path to usb device file (without number at end) sudo fdisk -l
iso="/path/to/windows.iso" # path to windows iso
@brownman
brownman / create_multiboot_usb.sh
Created September 2, 2015 15:48
format usb drive , install grub , add file.iso, run with qemu
source /tmp/library.cfg
set -x
set -u
set -e
#trap exiting EXIT
drive=${1:-sdX}
partition=${drive}1
file_iso=$HOME/Downloads/XenServer-6.5.0-xenserver.org-install-cd2.iso
mode_cp=cp
filename_iso='xenserver.iso'
#! /bin/bash
set -e
export WRAPPER="`readlink -f "$0"`"
HERE="`dirname "$WRAPPER"`"
. $HERE/../lib/utils.sh
. $HERE/../lib/os.sh
EAP=0
echo $* | grep eap > /dev/null && EAP=1
@brownman
brownman / wifi_linno.sh
Created June 11, 2015 13:51
wifi cli connect
set -u
ssid=Linnovate
echo type the password for connecting to $ssid
read password
sudo wpa_passphrase $ssid $password > /tmp/wpa0
cat /tmp/wpa0
sudo rfkill unblock all
sudo wpa_supplicant -Dwext -iwlan0 -c/tmp/wpa0
@brownman
brownman / replace_string.sh
Created April 1, 2015 11:53
rename package name: with/without capital letter
clear
replace2 ()
{
exclude_dir='.git';
old_string="$1";
new_string="$2";
path=$3;
cmd="grep --exclude-dir=$exclude_dir -rl '$old_string' $path | xargs sed -i s@$old_string@$new_string@g";
@brownman
brownman / rename_filename.sh
Last active August 29, 2015 14:18
rename filename - beware: must cd to directory before running it
clear
#Example: rename filename from article to phone:
#from=article
#to=phone
from=article
to=phone
@brownman
brownman / wifi.sh
Last active August 29, 2015 14:18
linux: auto connect wifi (for wpa2 encryption)
ssid=${1:-$SSID}
key=${2:-$PASSWORD}
test -n "$ssid" || { echo '[required args] : ssid password'; exit 0; }
pkgs='wpa_passphrase' #dhcp-gtk
type $pkgs || ( sudo apt-get install $pkgs)
connect_passwordless_wifi(){
commander sudo ifconfig $device up
commander sudo iw dev $device connect $ssid
@brownman
brownman / SassMeister-input-HTML.html
Created January 29, 2015 13:54
Generated by SassMeister.com.
<script>
var json1 = {site: 'www.google.com'};
</script>
<box>
<h1 class="abc" >sdf</h1>
</box>