This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/tclsh | |
| proc read_sock {sock} { | |
| set l [gets $sock] | |
| puts stdout "ServerReply:$l" | |
| } | |
| proc read_stdin {wsock} { | |
| global eventLoop | |
| set l [gets stdin] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/tclsh | |
| set svcPort 8001 | |
| proc doService {sock msg} { | |
| puts $sock "$msg" | |
| } | |
| proc svcHandler {sock} { | |
| set l [gets $sock] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MYDIR="/home/${USER}/archives" | |
| ls ${MYDIR}/*.tar > filelist | |
| for FILENAME in `cat filelist` | |
| do | |
| ARCHDIR=${MYDIR}/$(basename $FILENAME .tar) | |
| mkdir $ARCHDIR | |
| echo ==== Extracting $FILENAME to $ARCHDIR: | |
| tar -xf $FILENAME -C $MYDIR | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function() { | |
| $("input[type=button][value=Add]").click(function(e) { | |
| for (i = 0; i < document.getElementById('sel').value; i++) { | |
| e.preventDefault(); | |
| var j = 1; | |
| var newDiv = $("<div>").appendTo("#dropbox"); | |
| $("<select>").attr("name", "input1_"+j).appendTo(newDiv).append( | |
| $("<option>").val("0").text("Option 1"), $("<option>").val("1").text("Option 2")); | |
| $("<select>").attr("name", "input2_"+j).appendTo(newDiv).append( | |
| $("<option>").val("0").text("Option 1"), $("<option>").val("1").text("Option 2")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * | |
| !/a | |
| /a/* | |
| !/a/b | |
| /a/b/* | |
| !/a/b/c | |
| /a/b/c/* | |
| !/a/b/c/foo | |
| # don't forget this one |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rm contents.txt | |
| ls *.zip > filelist | |
| for FILENAME in `cat filelist` | |
| do | |
| unzip -l $FILENAME >> contents.txt | |
| done | |
| rm filelist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # To copy from the one file to several directories, use: | |
| find -maxdepth 1 -mindepth 1 -type d -exec cp ${1} {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| " This must be first, because it changes other options as side effect | |
| set nocompatible | |
| " Use pathogen to easily modify the runtime path to include all | |
| " plugins under the ~/.vim/bundle directory | |
| call pathogen#helptags() | |
| call pathogen#runtime_append_all_bundles() | |
| "Quickly edit/reload the vimrc file | |
| nmap <silent> <leader>ev :e $MYVIMRC<CR> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # mcsplit -- | |
| # | |
| # Splits a string based using another string | |
| # | |
| # Arguments: | |
| # str string to split into pieces | |
| # splitStr substring | |
| # mc magic character that must not exist in the orignal string. | |
| # Defaults to the NULL character. Must be a single character. | |
| # Results: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fdisk -l | grep '^Disk'; # list drives | |
| file -s /dev/sdd; # list device sdd details | |
| fsck /dev/sdd; # check device sdd | |
| fdisk /dev/sdd; # partition drive | |
| # m - print help | |
| # p - print the partition table | |
| # n - create a new partition | |
| # d - delete a partition | |
| # q - quit without saving changes |