Commit 0656a798 authored by epsi sayidina's avatar epsi sayidina

standalone: lang

parent 6ffbf597
import Data.Time.LocalTime
import Data.Time.Format
import Control.Concurrent
import Control.Monad
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- wrap Funktion
myTimeFormat = "%a %b %d %H:%M:%S"
wFormatTime :: FormatTime t => t -> String
wFormatTime myUtcTime = formatTime
Data.Time.Format.defaultTimeLocale myTimeFormat myUtcTime
wSleep :: Int -> IO ()
wSleep mySecond = threadDelay (div 1000000 mySecond)
printDate = do
wSleep 1
now <- getZonedTime
let nowFmt = wFormatTime now
putStrLn nowFmt
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- main
main = forever $ printDate
import System.Process
import System.Directory
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- wrap Funktion
-- source directory is irrelevant in Haskell
-- but we'll do it anyway for the sake of learning
wGetCmdIn :: String -> String
wGetCmdIn dirname = "conky -c "
++ dirname ++ "/../assets" ++ "/conky.lua"
cmdout = "less" -- or dzen2
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ---
-- main
main = do
dirname <- getCurrentDirectory
let cmdin = wGetCmdIn dirname
system (cmdin ++ " | " ++ cmdout)
#!/usr/bin/perl
# Unidirectional Pipe Example
# A pipe has a read end and a write end.
use warnings;
use strict;
use File::Basename;
use IO::Pipe;
my $dirname = dirname(__FILE__);
my $path = "$dirname/../assets";
my $cmdin = "conky -c $path/conky.lua";
my $cmdout = "less"; # or dzen2
my $pipein = IO::Pipe->new();
my $hnd_in = $pipein->reader($cmdin);
my $pipeout = IO::Pipe->new();
my $hnd_ou = $pipeout->writer($cmdout);
while(<$pipein>) {
print $pipeout $_;
flush $pipeout;
}
$pipein->close();
$pipeout->close();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment