Skip to content

Instantly share code, notes, and snippets.

View markogresak's full-sized avatar

Marko Grešak markogresak

View GitHub Profile
# 5. (rekurznivno iskanje imena)
preverImenik () {
imenik=${1:-"$HOME"}
for file in "${imenik}/*"; do
if [[ -d "$file" ]]; then
preverImenik "$file"
fi
if [[ "$file" == *"Abrakadabra"* ]]; then
echo "$file"
@markogresak
markogresak / benchmark.js
Last active August 29, 2015 14:27
Comparison of delete vs Reflect.deleteProperty
/**
* Benchmark process:
* - generate an array with 100.000 random elements (0 - 999.999)
* - in each sampler function, remove first element from array
* Removing first element might turn out with better performance
* compared to real world usage.
*
*
* Tested in io.js v3.0.0, babel-node v5.8.21
* before using, run: npm install benchmark harmony-reflect
@markogresak
markogresak / .README.md
Last active August 29, 2015 14:23 — forked from gnarf/..git-pr.md

Install

Either copy the aliases from the .gitconfig or run the commands in add-pr-alias.sh

Usage

Easily checkout local copies of pull requests from GitHub remotes:

  • git pr 4 - creates local branch pr/4 from the origin remote and checks it out
  • git pr 4 upstream - creates local branch pr/4 from upstream remote and checks it out

I was trying to make these measurements as accurate and fair as possible.

Note: I apologize for hacky code, I was trying to make this work as quick as possible.

Table of average times:

Environment Uncommented time [ms] Commented time [ms]
Chrome 460.254 424.725
Firefox 796.471 781.662

Matrika sodosti (H):

[0 0 0 0 1 1 1 1 1 1 1 1 0 0 0;
0 1 1 1 0 0 0 1 1 1 1 0 1 0 0;
1 0 1 1 0 1 1 0 0 1 1 0 0 1 0;
1 1 0 1 1 0 1 0 1 0 1 0 0 0 1]

Preslikovalna tabela za sindrom:

[15 14 1 13 2 3 4 12 5 6 7 8 9 10 11]

Zacetni vhodi

Na vhodu uporabimo funkcijo double(vhod), da dobimo vrednosti po 8 bit hkrati.

Inicializacija drevesa

Poiscemo unikatne znake (unique), izracunamo frekvence (histc) in verjetnosti (na podlagi frekvenc).

Inicializiramo drevo kot matriko. Stolpci so:

@markogresak
markogresak / self-signed-cert.md
Last active August 29, 2015 14:17
Self Signed X.509 certificate for SSL (local dev) on OSX
  1. Go to page and accept untrusted certificate

  2. Click lock in address bar to get certificate info: select Connection tab and click on Certificate information (In chrome ~41, could change in future versions)

  3. From the Certificate information window, drag the certificate image (see the image below to see what to drag) on deskop or in a finder window to save it locally

  4. Open Keychain Access.app and select File -> Import items... (⇧⌘I)

  5. From import menu, select dragged certificate and select System as Destination Keychain

@markogresak
markogresak / useful-commands.md
Last active August 29, 2015 14:14
Useful commands

Perform perl regexp (because grep on OS X (still) doesn't support it):

perl -ne 'print if /[regexp]/'

Print can use capturing groups or named capturing groups:

perl -ne 'print "$1\n" if /(.*)/'

Find and open with arbitrary command:

@markogresak
markogresak / vmware-ethernet.md
Last active December 29, 2020 12:49
Running vmware ethernet interface

cd to vmware library folder

cd /opt/homebrew-cask/Caskroom/vmware-fusion/6.0.4-1887983/VMware\ Fusion.app/Contents/Library

Commands

sudo ./vmnet-cfgcli vnetcfgadd VNET_7_DHCP no
sudo ./vmnet-cfgcli vnetcfgadd VNET_7_HOSTONLY_SUBNET 192.168.240.0
sudo ./vmnet-cfgcli vnetcfgadd VNET_7_HOSTONLY_NETMASK 255.255.255.0

sudo ./vmnet-cfgcli vnetcfgadd VNET_7_VIRTUAL_ADAPTER yes

@markogresak
markogresak / Navodila.md
Last active August 29, 2015 14:14
OS 1. izpitni rok 2015, 2. naloga

Napišite skripto, ki iz dveh datotek prebere podatke o študentih, ki opravljajo predmet OS in jih zlije v novo datoteko, primerno za nalaganje ocen na spletno učilnico.

Prva datoteka vsebuje skupne točke kvizov v CSV obliki vpisne številke in ocene med 0 in 5:

63123456, 4
63123457, 0
63101010, 5
...

Druga datoteka vsebuje točke izzivov v obliki vpisne številke, točke za posamezen izziv (10 izzivov) in vsote točk: