Skip to content

Instantly share code, notes, and snippets.

import java.io.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class UnzipUtility
{
/**
* Size of the buffer to read/write data
*/
private static final int BUFFER_SIZE = 4096;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
import javax.imageio.ImageIO;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;
<?php
/**
* @param {Integer} $n number of fibonacci sequence items
* @return {String} fibonacci numbers calculated using iterative
*/
function fibonacciNonRec($n){
if($n == 1) return '1';
if($n == 2) return '1, 1';
else {
$ret = '1, 1';
<?php
/**
* @param {Integer} $n number of fibonacci sequence items
* @return {String} fibonacci numbers calculated using recursion
*/
function fibonacciRec($n, $a = array()){
if(!isset($a[0]) || $a[0] != 1){
$a[0] = 1;
}
#!/bin/bash
if [[ -d $1 ]]; then
echo "$1 is a directory"
scp -r $1 [email protected]:/home/user/folderToUploadTo
elif [[ -f $1 ]]; then
echo "$1 is a file"
scp $1 [email protected]:/home/user/folderToUploadTo
else
echo "error $1 is not valid"
exit 1
function [singular, x] = gaussian(A, b)
rozmiar = size(A, 1);
zmiany = zeros(rozmiar, 1);
e = 1E-12;
eglowny = 0;
bool = 1;
for i=1:rozmiar
zmiany(i,1) = i;
//wybor elementu glownego
function [value] = gauss_seidel(A, b, x0, n)
rozmiar = size(A,1);
suma1 = 0;
suma2 = 0;
r = x0; //kolejne przyblizenia
for k=1 : n //wykonaj n krokow metody
for w=1 : rozmiar //kolejne wspolrzedne rozwiazania w k-tym kroku metody
//wykorzystuje 'stare' r
function [x] = minimal (A, b)
x = linsolve(A'*A,-(A'*b))
endfunction
function [result] = gauss_quadrature(f,lower, upper, n, intervals)
res = 0;
bigInterval = upper - lower;
smallInterval = bigInterval/intervals;
down = lower;
up = down + smallInterval;
for i=1:intervals
calk = 0;