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; | |
# args: login shell | |
sub change_shell { | |
my $username = shift; | |
my $shell = shift; | |
my @command = ("chsh", "-s ".$shell, $username ); | |
system(@command) or print STDERR "Failed to chsh"; |
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
# hash: login, uid, pass, dir, | |
sub add_user { | |
my(%args) = %{$_[0]}; | |
my $command = "adduser -m "; | |
if (defined $args{'uid'}) { | |
$command .= "-u ".$args{'uid'}; | |
} | |
if (defined $args{'dir'}) { |
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
set RETAILERS ordered := 1 .. 23; | |
set DIVISIONS; | |
set MATERIALS; | |
var oilMarket{i in 1 2 3}; | |
var Agroup; | |
var Bgroup; | |
var spiritMarket; | |
param matrix; | |
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
#coding: utf-8 | |
from cStringIO import StringIO | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.header import Header | |
from email import Charset | |
from email.generator import Generator | |
import smtplib | |
# Example address data |
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
main = do | |
handle <- openFile "todo.txt" ReadMode | |
(tempName, tempHandle) <- openTempFile "." "temp" | |
contents <- hGetContents handle | |
let todoTasks = lines contents | |
numberedTasks = zipWith (\n line -> show n ++ " - " ++ | |
line) [0..] todoTasks | |
putStrLn "These are your TO-DO items:" | |
putStr $ unlines numberedTasks | |
putStrLn "Which one do you want to delete?" |
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 Car a b c = Car { company :: a | |
, model :: b | |
, year :: c | |
} deriving (Show) | |
tellCar :: Car -> String | |
tellCar (Car {company = c, model = m, year = y} = "This " ++ c ++ " " ++ m ++ " was made in " | |
) | |
++ show y |
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
module Parser where | |
import Data.Time | |
import Prelude hiding (catch) | |
import qualified Control.OldException as C | |
-- funkcja wczytujaca date z konsoli (waliduje jej poprawnosc) | |
-- return: IO Day - data podana z konsoli | |
getDay :: IO Day |
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
/** One More Application | |
Imagine that you were creating a lottery application (or more likely, a lottery view within another application). You might have 10 views, each with a number, and you highlight each image as a number is drawn. In this case, you’d probably have ten instance variables, maybe named numberView1, numberView2, all the way to numberView10. To light up the views, you could have a large if…else or switch block, comparing the new value to all the values 1–10: | |
**/ | |
int nextNum = arc4random() % 10 } 1; // Random number generator, 1–10 | |
switch (nextNum) { | |
case 1: | |
// Highlight | |
break; | |
// etc. | |
} |
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
/** One More Application | |
Imagine that you were creating a lottery application (or more likely, a lottery view within another application). You might have 10 views, each with a number, and you highlight each image as a number is drawn. In this case, you’d probably have ten instance variables, maybe named numberView1, numberView2, all the way to numberView10. To light up the views, you could have a large if…else or switch block, comparing the new value to all the values 1–10: | |
**/ | |
int nextNum = arc4random() % 10 } 1; // Random number generator, 1–10 | |
switch (nextNum) { | |
case 1: | |
// Highlight | |
break; | |
// etc. | |
} |
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
{ | |
"SyncDictionaries": [ | |
{ "Occasion_Types": | |
[ | |
{ | |
"is_deleted": false, | |
"id": 40, |
OlderNewer