Skip to content

Instantly share code, notes, and snippets.

Goran Rakic grakic

Block or report user

Report or block grakic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@grakic
grakic / HTMLRewriter.js
Created May 3, 2020
CloudFlare Workers HTMLRewriter mock based on cheerio
View HTMLRewriter.js
import cheerio from 'cheerio'
/**
* TODO: This code is not optimized for production!
* Usage of cheerio here only simulates stream-oriented parser! It is slow!
*/
function replace(content, options) {
// TODO: Handle {html:true/false} in options
this[0].nodeValue = content
View webpack.config.js
const webpack = require('webpack');
const SentryCliPlugin = require('@sentry/webpack-plugin');
module.exports = {
entry: './src/index.js',
target: 'webworker',
mode: 'production',
output: {
path: __dirname + '/dist',
publicPath: 'dist',
@grakic
grakic / DigSigCerts.reg
Created Sep 23, 2017
MUP CA sertifikati
View DigSigCerts.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\ROOT\Certificates\4FA8D4904A9CCC0B8D43695314EE3E7FB5A472F2]
"Blob"=hex:04,00,00,00,01,00,00,00,10,00,00,00,0f,b9,7c,a2,7c,0d,a8,d0,9e,51,\
71,79,cd,73,95,7b,0f,00,00,00,01,00,00,00,14,00,00,00,44,e5,3d,56,25,16,12,\
55,f5,56,4b,6f,bb,b0,79,f1,3d,48,64,d9,14,00,00,00,01,00,00,00,14,00,00,00,\
3f,66,b0,0f,66,fb,f0,10,2e,61,a4,6f,ef,2c,95,8a,14,72,6f,71,19,00,00,00,01,\
00,00,00,10,00,00,00,3c,50,45,8d,84,e7,ce,3f,b2,0c,66,49,42,a1,35,96,03,00,\
00,00,01,00,00,00,14,00,00,00,4f,a8,d4,90,4a,9c,cc,0b,8d,43,69,53,14,ee,3e,\
7f,b5,a4,72,f2,5c,00,00,00,01,00,00,00,04,00,00,00,00,10,00,00,20,00,00,00,\
@grakic
grakic / models.py
Last active Nov 29, 2019
SQLAlchemy EAV example
View models.py
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm.collections import attribute_mapped_collection
from sqlalchemy.ext.associationproxy import association_proxy
db = SQLAlchemy()
class Entity(db.Model):
def __init__(self, description, values = None):
self.description = description
@grakic
grakic / ePorezi-macOS.md
Last active May 1, 2020
ePorezi na macOS
View ePorezi-macOS.md

ePorezi na macOS

Zvanična klijentska aplikacija Poreske uprave se može preuzeti sa njihove stranice.

U pitanju je Java aplikacija koja dolazi sa posebno priređenom distribucijom Oracle Java radnog okruženja. Aplikacija podržava samo Microsoft Windows operativni sistem i sertifikatima u Personals skladištu pristupa kroz Microsoft CryptoAPI koji poziva operacije na pametnoj kartici ili tokenu posredstvom midlvera.

Sertifikaciono telo Pošte korisnicima nudi SafeSign midlver, osim u verziji za Windows i u verziji za GNU/Linux i macOS operativne sisteme. Midlver isporučuje prateću aplikaciju za upravljanje karticom/tokenom i PKCS#11 biblioteku. Programi poput jSignPDF, Adobe Reader ili LibreOffice mogu da učitaju ovu biblioteku i omoguće korisniku elektronsko potpisivanje dokumenata.

Elektronsko potpisivanje se koristi i na portalu ePorezi Poreske uprave, posredstvom pomenute klijentske aplikacije.

@grakic
grakic / ePorezi-Linux.md
Last active Jun 12, 2018
ePorezi na GNU/Linuxu
View ePorezi-Linux.md

ePorezi na GNU/Linuxu

Zvanična klijentska aplikacija Poreske uprave se može preuzeti sa njihove stranice.

U pitanju je Java aplikacija koja dolazi sa posebno priređenom distribucijom Oracle Java radnog okruženja. Aplikacija podržava samo Microsoft Windows operativni sistem i sertifikatima u Personals skladištu pristupa kroz Microsoft CryptoAPI koji poziva operacije na pametnoj kartici ili tokenu posredstvom midlvera.

Sertifikaciono telo Pošte korisnicima nudi SafeSign midlver, osim u verziji za Windows i u verziji za GNU/Linux i macOS operativne sisteme. Midlver isporučuje prateću aplikaciju za upravljanje karticom/tokenom i PKCS#11 biblioteku. Programi poput jSignPDF, Evolution ili LibreOffice mogu da učitaju ovu biblioteku i omoguće korisniku elektronsko potpisivanje dokumenata.

Elektronsko potpisivanje se koristi i na portalu ePorezi Poreske uprave, posredstvom pomenute klijentske aplikacije.

View RelatedVersioningPlugin.py
from sqlalchemy_continuum.plugins import Plugin
from sqlalchemy_continuum import Operation
from sqlalchemy.inspection import inspect
class RelatedVersioningPlugin(Plugin):
def __init__(self):
self.class_registry = []
@grakic
grakic / functions.php
Last active Jan 24, 2016
Load custom WP Jetpack translations
View functions.php
<?php
define('CHILD_DIR', get_stylesheet_directory());
/**
* Load Jetpack translations from themes/<theme>/lang/jetpack-sr_RS.mo
*/
function my_theme_setup()
{
unload_textdomain('jetpack');
@grakic
grakic / cookiejar.php
Created Jun 16, 2015
Cookiejar to $_COOKIE and back
View cookiejar.php
function save_to_cookiejar($cookiefile)
{
$jar = "";
foreach ($_COOKIE as $name => $value)
{
$name = urlencode($name);
$value = urlencode($value);
$jar .= "{$_SERVER['HTTP_HOST']}\tFALSE\t/\tFALSE\t0\t{$name}\t{$value}\n";
}
file_put_contents($cookiefile, $jar);
@grakic
grakic / wp_require_login.php
Last active Aug 29, 2015
Simple WordPress plugin to require login for site access, showing welcome content on frontpage for non-authenticated users. Uses personalized links to authorize access to feeds.
View wp_require_login.php
<?php
/*
Plugin Name: Require Login
Plugin URI:
Author: Goran Rakic
Version: 2.0
Author URI: http://blog.goranrakic.com
*/
/**
You can’t perform that action at this time.