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
#include <cstdio>
#include <functional>
using namespace std;
int edgeOperation(int &n);
int productOperation(int &n);
const function<int(int &)> operations[2] = {&productOperation, &edgeOperation};
int edgeOperation(int &n) {
--n;
@banan314
banan314 / swapiness.md
Created November 11, 2017 10:36
swapiness on Linux
  • Change Swappiness Value
  1. Run terminal
  2. Enter following line to see current swappiness value cat /proc/sys/vm/swappiness (default value in Ubuntu for swappiness is 60)
  3. Open file /etc/sysctl.conf in a text editor, I did vim /etc/sysctl.conf
  4. Enter the following parameter

Decrease swappiness value

vm.swappiness=10

@banan314
banan314 / seminarium7.md
Last active November 3, 2017 15:43
Skrót z pierwszych zajęć

Aby zaliczyć przedmiot, należy przygotować prezentację nt. swojej pracy inż (lic/magist?). Przykładowa prezentacja (z poprzedniego semestru): http://docdro.id/S8REdty

Plan:

  1. Strona tytułowa (imię, nazwisko, opiekun)
  2. Cel pracy
  3. Technologie a. wykorzystane b. przykłady innych zastosowań
  4. Przedstawienie pracy (LIVE, screenshots || video)
  5. Podsumowanie
@banan314
banan314 / find_codes.pl
Last active June 25, 2017 13:35
Znajdź kody pocztowe w pliku
#!/usr/bin/perl
use strict;
my $filename = "kody.txt";
open my $kody, "<", $filename or die("Nie mogę otworzyć pliku ($!)!");
while (<$kody>)
{
my $matched = m/(\d{2}-\d{3})/;
my ($kod) = m/(\d{2}-\d{3})/;
@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");
@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);
}

On downloading zip

git init
git reset HEAD --
git remote add origin https://github.com/lukaszmalec6/anatomy
git fetch
git branch --track master origin/master

Branch master set up to track remote branch master from origin.

Configure:

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

and then download image:

cd /srv/tftp/
@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.

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