Skip to content

Instantly share code, notes, and snippets.

View banan314's full-sized avatar
🏠
Working from home

Kamil Łopuszański banan314

🏠
Working from home
View GitHub Profile
@banan314
banan314 / IPv4Validator.java
Last active January 2, 2017 15:37
validate IPv4 address
import java.util.InputMismatchException;
import java.util.Scanner;
import java.util.regex.*;
public class IPv4Validator {
private String ipv4;
private final String IPv4Regex = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}";
IPv4Validator(String ipv4) {
@banan314
banan314 / cars.cpp
Last active February 8, 2017 17:32
pojazd<|-samochod
#include <string>
using namespace std;
class Pojazd {
private:
string lusterko[3] = {"lewe", "prawe"};
public:
//friend class Samochod;
Pojazd& operator=(const Pojazd&);
@banan314
banan314 / cars-operators.cpp
Created February 8, 2017 17:33
shallow/deep copy
#include <iostream>
#include <string>
using namespace std;
class Pojazd {
private:
string lusterko[3] = {"lewe", "prawe"};
protected:
int id = 0;
@banan314
banan314 / 2klawisze.md
Created March 21, 2017 17:08
DJJ 9dan master

2 klawisze + 2 diody , kolejność ma znaczenie

Jeśli wciśniemy 1. klawisz, a potem 2., w 2-sekundowym odstępie, to zapalamy 1. LED na 2s. Jeżeli odstęp jest większy niż 2s, to zapalamy 1. LED na 4s. Jeżeli wciśniemy w odwrotnej kolejności, to zapalamy 2. LED i zamaist na 2s, to na 3s. 2-sekundowego świecenie da się przerwać poprzez puszczenie któregokolwiek z klawiszy. 4-sekundowego świecenia nie da się przerwać.

/*
Created 06.04.2017
Modified 06.04.2017
Project
Model
Company
Author
Version
Database MS SQL 7
*/
czas P1 P2 P3 Z1 Z2 Z3 Z4 Z5 M G T
==================================================================
0.10 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
0.20 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
0.30 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
0.40 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
0.50 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
0.60 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
0.70 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
0.80 0.000 0.000 0.000 0 0 0 0 0 0 0 20.000
@banan314
banan314 / anatomy_proxy.md
Last active May 7, 2017 14:14
Instruction for anatomy project

Instruction

How to proxy backend in anatomy project.

After running backend server, we start the main application, using

ng serve --proxy-config proxy.conf.json

or just npm start as always.

The configuration proxys all request on adresses /backend(*) to localhost:33333$1.

Configure:

cd /srv;
mkdir tftp;
chmod 777 -R tftp;
chown nobody:nogroup -R tftp;

and then download image:

cd /srv/tftp/
@banan314
banan314 / COM_send_m.c
Created June 2, 2017 12:41
send multiple characters using `COM_send`
#include <stdarg.h>
void COM_send_m(int n, ...) {
va_list send;
va_start(send, n);
while(n--)
COM_send(va_arg(send, char*));
va_end(send);
}
@banan314
banan314 / db-api.ts
Created June 6, 2017 15:15
db element from front
.post(upload.array(), function (req, res) {
let elem = new AnatomyElement();
let bodyElement = req.body.element;
elem.id = bodyElement.id;
elem.name = bodyElement.name;
elem.description = bodyElement.description;
elem.x = bodyElement.x;
elem.y = bodyElement.y;
elementService.createElement(elem);
res.send("post");