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
| ./radius.sh ps | perl -ne 'print if $a{$_}++' - |
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/perl | |
| use warnings; | |
| use strict; | |
| use XML::LibXML::Reader; | |
| my $reader = XML::LibXML::Reader->new(location => 'input.txt') or die; | |
| while ($reader->read) { | |
| if ($reader->nodePath =~ m{/tagname$} # We are at <tagname> or </tagname>. |
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
| data Log a = Log [String] a deriving Show | |
| returnLog :: a -> Log a | |
| returnLog x = Log [] x | |
| bindLog :: Log a -> (a -> Log b) -> Log b | |
| bindLog (Log a x) f = Log (a ++ b) y where | |
| (Log b y) = f x | |
| instance Monad Log where |
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
| data Bit = Zero | One deriving Show | |
| data Sign = Minus | Plus deriving Show | |
| data Z = Z Sign [Bit] deriving Show | |
| toInt1:: Bit -> Int | |
| toInt1 Zero = 0 | |
| toInt1 One = 1 | |
| toInt:: Z -> Int | |
| toInt (Z Minus xs) = 0 - (toInt (Z Plus xs)) |
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
| - name: Get Slave Status | |
| mysql_replication: mode=getslave | |
| register: slaveStat | |
| - name: Are we ok? | |
| debug: msg="Do it" | |
| when: > | |
| (slaveStat.Seconds_Behind_Master < 1) | |
| and (slaveStat.Slave_IO_Running=="Yes") |
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
| #!env perl | |
| while(<DATA>){ | |
| my ($pr,$n,$po,$m) = split /\s/; | |
| @list=(); | |
| $s=$n+$m; | |
| $prev=0; | |
| while($n+$m>0){ | |
| $who= int(rand(2)); | |
| if($who and $prev){ |
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
| ENV DEBIAN_FRONTEND noninteractive | |
| ENV PHANTOM_JS_VERSION 1.9.7-linux-x86_64 | |
| apt-get update | |
| apt-get install -y curl bzip2 libfreetype6 libfontconfig | |
| curl -sSL https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-$PHANTOM_JS_VERSION.tar.bz2 | tar xjC / | |
| ln -s phantomjs-$PHANTOM_JS_VERSION /phantomjs |
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
| ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", DRIVERS=="usb-storage", GOTO="automount_go" | |
| ACTION=="remove", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem", DRIVERS=="usb-storage", RUN{program}+="/bin/rmdir /media/%E{AUTOMOUNT_NAME}" | |
| GOTO="automount_end" | |
| LABEL="automount_go" | |
| PROGRAM="/usr/local/bin/automount-helper.py $number", GROUP="disk", TAG+="systemd", ENV{AUTOMOUNT_NAME}="$result{1}", ENV{SYSTEMD_WANTS}="usb-mount@$result{2}.service" | |
| LABEL="automount_end" |
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
| add | |
| val _ = OS.Process.exit(OS.Process.success) | |
| while inotifywait -e delete_self hw2provided.sml; do sml hw2test.sml; 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
| #!/usr/bin/perl -w | |
| $dbh = | |
| DBI->connect( "DBI:mysql:dbname=mydb;", "root", "mypass", | |
| { RaiseError => 0, PrintError => 0, AutoCommit => 1 } ); | |
| $dbh->{'mysql_auto_reconnect'} = 1; | |
| $stu1 = $dbh->prepare("update smt set value=?"); | |
| $sti1 = $dbh->prepare("insert int bbb values (?,?)"); |