Skip to content

Instantly share code, notes, and snippets.

@maciektr
maciektr / rsa.cpp
Last active June 7, 2018 10:13
A simple RSA implementation for small numbers
#include<iostream>
#include <vector>
using namespace std;
using LLong = long long int;
LLong gcd(LLong a, LLong b){
return (b ? gcd(b,a%b):a);
}
@maciektr
maciektr / config.json
Created June 1, 2018 10:32
nodjes config file example
{
"category":{
"option" : "value"
}
}
@maciektr
maciektr / MillerRabin.cpp
Last active October 24, 2020 11:08
A Miller-Rabin test C++ implementation
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
//Tested for numbers less than 10^18
const int numbOfPrimes = 10;
const int primeNumb[]={2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
@maciektr
maciektr / Skrypt.sh
Created January 14, 2019 21:28
Skrypt z laboratoriów z unixów
#!/bin/bash
if [ $# -eq 0 ]; then
echo -n "Podaj UIDs: "
read NUMERY
else
NUMERY=$*
fi
for NUM in $NUMERY; do
OPIS=`cat /etc/passwd | cut -d : -f 3,5 | grep "^$NUM:" | cut -d: -f2`
#include<bits/stdc++.h>
using namespace std;
struct node{
int value;
node *next;
node(int v, node *n):value(v),next(n){}
};
void printList(node *head);
int countToEnd(node *head);
#include<bits/stdc++.h>
using namespace std;
const int K = (int)'z'+1;
bool anagram(int *a, int *b,const int N){
int tab[K];
for(int i = 0; i<K; i++)
tab[i] = 0;
int changed=0;
#include <bits/stdc++.h>
using namespace std;
// #define local 0
// #define DEBUG if(local)
// #define VAR(v) #v << "= " << v << " "
// #define COUT cout << "\e[36m" <<
// #define ENDL "\e[39m" << endl
const int inf = 2000000;
@maciektr
maciektr / RandomNIP.py
Last active January 11, 2020 10:44
Generating random, valid, polish tax payer identification number with simple Python snippet
def random_nip(self):
res = ''
sum = 0
weights = [6, 5, 7, 2, 3, 4, 5, 6, 7]
for i in range(8):
k = self.rand.randint(1 if i < 3 else 0, 9)
sum += weights[i] * k
res += str(k)
k = self.rand.randint(0, 9)
if (sum + (k * weights[8])) % 11 == 10:
; Ascii characters
; Char 'a' can be accessed as:
; ascii + 8 * 'a'
rend_char segment
ascii db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; U+0000 (nul)
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; U+0001
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; U+0002
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; U+0003
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; U+0004
db 000h, 000h, 000h, 000h, 000h, 000h, 000h, 000h ; U+0005

Keybase proof

I hereby claim:

  • I am maciektr on github.
  • I am mtratnow (https://keybase.io/mtratnow) on keybase.
  • I have a public key ASCC0EqQXPjqbDSL6DrRPg4YOGkm4_WMqBiABU4IDw_lMAo

To claim this, I am signing this object: