This file contains 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
#include <stdio.h> | |
int main(int argc, char ** argv){ | |
int a,b; | |
printf("Program policzy roznice dwoch liczb,podaj pierwsza z nich \n"); | |
scanf("%d \n",&a); | |
printf("Podaj druga liczbe \n"); | |
scanf("%d \n",&b); | |
printf("roznica wynosi %d ", a-b); | |
getchar(); | |
return 0; |
This file contains 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
#include <stdio.h> | |
main() { | |
FILE * plik; // uchwyt do pliku | |
char bufor[100]; // zawartosc tego bufora zapiszemy do pliku | |
plik = fopen("plik_wyjsciowy.txt", "w"); // otwarcie pliku do odczytu | |
scanf("%99s", bufor); // wczytanie lancucha znakowego do bufora (99 poniewaz musi sie zmiescic jeszcze \0) | |
fputs(bufor, plik); // zapis do pliku |
This file contains 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
#include <stdio.h> | |
main() { | |
int wielkosc_bufora = 100; | |
char bufor[wielkosc_bufora]; // bufor do ktorego bedziemy czytac dane | |
FILE * plik; // zmienna zawierajaca uchwyt do pliku | |
plik = fopen("plik_wejsciowy.txt", "r"); // sciezka do pliku, tryb otwarcia do odczytu | |
fgets(bufor, wielkosc_bufora - 1, plik); // wczytanie pierwszych 99 bajtow pliku do bufora (PAMIETAJ - (wielkosc bufora - 1) poniewaz musisz zostawic miejsce na \0 w stringu |
This file contains 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
pivot(_, [], [], []). | |
pivot(Pivot, [Head|Tail], [Head|LessOrEqualThan], GreaterThan) :- Pivot >= Head, pivot(Pivot, Tail, LessOrEqualThan, GreaterThan). | |
pivot(Pivot, [Head|Tail], LessOrEqualThan, [Head|GreaterThan]) :- pivot(Pivot, Tail, LessOrEqualThan, GreaterThan). | |
quicksort([], []). | |
quicksort([Head|Tail], Sorted) :- pivot(Head, Tail, List1, List2), quicksort(List1, SortedList1), quicksort(List2, SortedList2), append(SortedList1, [Head|SortedList2], Sorted). |
This file contains 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
# | |
# Utility functions to spawn terminals automatically | |
# @kubek2k 2012 | |
# | |
# sample usage: | |
# open_new_session_and_run_command ssh myhost tail -f /log/syslog.log | |
YAKUAKE_DBUS="qdbus org.kde.yakuake" | |
function close_session { |
This file contains 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/bash | |
get_last_change() { | |
find .git -type f -exec stat -f "%m %N" {} \; | sort -nr | head -1 | awk '{print $1}' | |
} | |
while [ true ]; do | |
LAST_CHANGE=`get_last_change` | |
clear | |
GIT_PAGER="cat" git log --format=oneline --abbrev-commit --decorate --graph --all |
This file contains 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
(defn sha256 [string] | |
(let [digest (.digest (MessageDigest/getInstance "SHA-256") (.getBytes string "UTF-8"))] | |
(apply str (map (partial format "%02x") digest)))) |
This file contains 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
environment.servlets().addFilter("cors-filter", CrossOriginFilter.class) | |
.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*"); |
This file contains 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
class X: | |
def __enter__(self): | |
print "entering" | |
def __exit__(self, exception_type, exception_val, trace): | |
print "exiting" | |
def restart(): | |
return X() |
This file contains 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 Main where | |
primes = 1:(nextPrime 2 []) | |
divisibleByAny x numbers = any (\n -> (rem x n) == 0) numbers | |
nextPrime start primesSoFar = let | |
nextP = head (dropWhile (\x -> divisibleByAny x primesSoFar) [start..]) | |
in | |
nextP:(nextPrime (nextP + 1) (nextP:primesSoFar)) |
OlderNewer