Skip to content

Instantly share code, notes, and snippets.

View karol-preiskorn's full-sized avatar
👩‍💻
Programming remote from home

C2RLO karol-preiskorn

👩‍💻
Programming remote from home
View GitHub Profile
@karol-preiskorn
karol-preiskorn / liczby_pierwsze.c
Created January 19, 2016 19:41
W zakresie 30 do 30000 takie, że zarówno suma, jak i iloczyn ich cyfr są również liczbami pierwszymi
#include <stdlib.h> /* qsort() */
#include <stdio.h> /* printf() */
// tablica liczb pierwszych
int tablica[30001];
/**
Sito Erastotenesa
@karol-preiskorn
karol-preiskorn / unx_sys_fork_env_z1.c
Last active March 4, 2020 11:10
Napisz program, który pokazuje, które atrybuty procesu macierzystego są dziedziczone przez proces potomny uruchomiony za pomocą funkcji fork(), które zaś otrzymują nową wartość.
/**
* Zadania
* -------
* z1: Napisz program, który pokazuje, które atrybuty procesu macierzystego dziedziczone przez proces potomny uruchomiony za pomocą funkcji fork(), które zaś otrzymują nową wartość.
* z2: Napisz program, który pokazuje, które atrybuty procesu zachowane przez proces po wykonaniu funkcji exec().
* z3: Napisz program, który wyświetla identyfikator procesu (PID) i nazwę związanego z nim polecenia dla wszystkich procesów uruchomionych przez użytkownika podanego w wierszu wywołania programu. Wskazówka: informacje te można uzyskać przeglądając katalog /proc z plików (interesują nas katalogi, których właścicielem jest dany użytkownik) i pliki /proc/PID/status
*
* Każdy proces charakteryzuje się pewnymi atrybutami. Należą do nich:
* Identyfikator procesu PID
* Identyfikator procesu macierzystego PPID
@karol-preiskorn
karol-preiskorn / BrianBrain
Last active March 4, 2020 11:12
BrianBrain
/**
* Brian's Brain
*
* Rules:
* -------
* Each cell has three possible states: passive, active, and semi-active.
* If a cell is active, it goes to semi-active state on the next step
* If a cell is semi-active, it becomes passive on the next step
* If a cell is passive, it becomes active if and only if it has exactly 2 active neighbors
*
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Projekt PHP</title>
</head>
<body>
<h1>Projekt PHP</h1>
<ol>
<li>Stwórz tablicę (z użyciem html). Napisz funkcję, za pomocą której wyświetlisz tablicę. Wy-świetl tablicę.</li>
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ppj;
/**
*
* @author KPreiskorn
from datetime import datetime
from dateutil import relativedelta
def days_between(d1, d2):
d1 = datetime.strptime(d1, "%Y-%m")
d2 = datetime.strptime(d2, "%Y-%m")
return relativedelta.relativedelta(d2, d1)
print(days_between("2016-04","2020-02"))
@karol-preiskorn
karol-preiskorn / wlan-ubuntu.md
Created March 3, 2024 07:30
Setup wlan on Ubuntu

Wakeup laptop online

  • nmcli d wifi list
  • sudo apt install iw

Enable WoWLAN for the phy0 device with magic packet:

  • iw phy0 wowlan show
  • sudo iw phy0 wowlan enable magic-packet
  • sudo iw phy0 wowlan enable any
  • sudo iw phy0 wowlan enable magic-packet disconnect