Skip to content

Instantly share code, notes, and snippets.

View ph4r05's full-sized avatar
🎯
Focusing

Dušan Klinec ph4r05

🎯
Focusing
View GitHub Profile
@ph4r05
ph4r05 / sks-dump-script.sh
Created February 14, 2017 12:34 — forked from mattrude/sks-dump-script.sh
A simple script to export the full database of a sks server to a chosen location.
#!/bin/bash
# This script will stop the sks server, dump it's contents to
# the $PREDIR, then restart the sks server.
#
# Matt Rude <matt@mattrude.com> PGP: 0xDD23BF73
# URL: https://gist.github.com/mattrude/b0ac735d07b0031bb002
SKSDATE=`date +%Y-%m-%d`
USER="debian-sks"
@ph4r05
ph4r05 / pyx509_parse.py
Created March 25, 2017 08:04
Parsing X509 certificate, domain extraction
from cryptography.hazmat.backends import default_backend
from cryptography.x509.base import load_pem_x509_certificate
from cryptography.hazmat.primitives.serialization import load_ssh_public_key
from cryptography.hazmat.primitives import hashes
from cryptography.x509.oid import NameOID
from cryptography.x509.oid import ExtensionOID
from cryptography import x509
def get_backend(backend=None):
--
-- Column DB encryption with indexing using pgcrypto
--
-- Demo encrypt/decrypt identity with pgcrypto
select convert_from(
decrypt_iv(
encrypt_iv(
'test',
digest('superkey', 'sha256'),
# task 1: implement logical formula evaluation
# T, F ~ true, false
# !, A, V, > ~ NOT, AND, OR, IMPLICATION
# Hint: translate atoms to integers (store integers on stack)
# Hint: the infix form: (!(F)) A (!((T) > (F)))
def eval_formula(inp):
stack = []
for token in inp:
pass
@ph4r05
ph4r05 / demo.java
Last active November 13, 2018 09:35
Simple java intro test
import javax.crypto.IllegalBlockSizeException;
class Main {
// Normally each class should be in a separate file.
static class Student {
private String name;
public Student(String name){
this.name = name;
class mt19937(object):
# https://github.com/james727/MTP/
def __init__(self, seed = 0):
self.state = [0]*624
self.f = 1812433253
self.m = 397
self.u = 11
self.s = 7
self.b = 0x9D2C5680
self.t = 15
@ph4r05
ph4r05 / zim-wiki-mac-osx-app.md
Created May 17, 2017 11:02 — forked from akurani/zim-wiki-mac-osx-app.md
Create a Mac app for Zim Wiki.

Keybase proof

I hereby claim:

  • I am ph4r05 on github.
  • I am ph4r05 (https://keybase.io/ph4r05) on keybase.
  • I have a public key ASDEM5I9j-myX__FRTNz-6aGWqpYkYwZVvQqzIVtRKeEdgo

To claim this, I am signing this object:

@ph4r05
ph4r05 / keybase.md
Created September 10, 2019 06:46
keybase.md

Keybase proof

I hereby claim:

  • I am ph4r05 on github.
  • I am ph4r05 (https://keybase.io/ph4r05) on keybase.
  • I have a public key ASDEM5I9j-myX__FRTNz-6aGWqpYkYwZVvQqzIVtRKeEdgo

To claim this, I am signing this object:

@ph4r05
ph4r05 / booltest-halving-demo.md
Last active December 18, 2019 14:55
Booltest halving demo test

Here is a simple demo for the BoolTest vs BoolTest-halving:

I was testing a simple PNG image with the BoolTest. Here are the differences presented: Tested PNG: https://i.kym-cdn.com/entries/icons/original/000/005/908/idontwanttoliveonthisplanet.jpg

Summary

NormalBooltest:

- best poly zscore  12.33883, expp: 0.0625, exp:     227, obs:     407, diff: -79.2951542 %, poly: [[114, 170, 154, 178]]
Ref samples: 40005, min-zscrore: 4.838657, max-zscore: 7.835336, best observed: 12.33882879511837, rejected: True, alpha: 2.4996875390576178e-05