Skip to content

Instantly share code, notes, and snippets.

🏗
Building.

Oto Brglez otobrglez

🏗
Building.
Block or report user

Report or block otobrglez

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
@otobrglez
otobrglez / pg_optimisation.sql
Last active Mar 28, 2018
Optimising N+1 problem in PG with "json_agg"
View pg_optimisation.sql
WITH question_options_f AS
( SELECT id,
question_id,
name,
fixed,
nota,
name_html,
name_raw
FROM question_options
WHERE deleted_at IS NULL
@otobrglez
otobrglez / data.yml
Created Mar 21, 2018
Transforming yaml to another yaml.
View data.yml
header:
label: 'Header'
breakpoint:
fallback:
name: header_fallback
label: 'Header @ fallback (306 x 172)'
width: 306
height: 172
small:
name: header_small
View spam.txt
Pozdrav!
Ne pomnem, da bi kadarkoli dal dovoljenje za uporabo mojega maila v komercialne namene.
S pošiljanjem tovrstnih sporočil brez mojega soglasja kršite ZEKom-UPB1, ZVPot-UPD2, ZEPT in ZVOP-1.
http://www.arnes.si/pomoc-uporabnikom/varnostna-priporocila/nezelena-elektronska-posta-spam/zakonodaja.html
Ob naslednjem sporočilu vas prijavim na:
1) Agencijo za komunikacijska omrežja in storitve (info.box@akos-rs.si)
@otobrglez
otobrglez / sync.sh
Last active Oct 19, 2017
Bash script for syncing WordPress theme to FlyWheel (sftp with lftp)
View sync.sh
#!/usr/bin/env bash
# Oto Brglez - <otobrglez@gmail.com>
set -e
# Set path where your theme lives on server.
THEME_DIRECTORY=/org-myorg/site/wp-content/themes/some-theme
lftp -u $FLYWHEEL_USER,$FLYWHEEL_PASS sftp://sftp.flywheelsites.com << --EOF--
set sftp:auto-confirm yes
set ssl:verify-certificate false
@otobrglez
otobrglez / REPORT.md
Created May 19, 2017
arp-scan / arp-fingerprint "bomb"
View REPORT.md

Problem && how to replicate?

  1. Najprej arp-scan
sudo arp-scan -r 3 -b 2 --localnet --ouifile=data/nmap-mac-prefixes.txt

Output:

View dict_example.py
#!/usr/bin/env python
from pprint import pprint
servers = {
"0.0.1.1": {
"status": "OK"
},
"0.0.1.2": {
"status": "ERROR"
@otobrglez
otobrglez / yaml_to_json.sh
Created Jun 3, 2016
YAML to JSON - one-liner with Ruby
View yaml_to_json.sh
# Single line of Ruby <3.
ruby -rjson -ryaml -e "puts YAML.load_file('my_file.yml').to_json"
# You can also pipe it to Python to get pretty ouput
ruby -rjson -ryaml -e "puts YAML.load_file('my_file.yml').to_json" | \
python -mjson.tool
# Thats all. :)
View 24h_keys.sh
#!/usr/bin/env bash
redis-cli \
-h <host> \
-p <port> \
-a <pass> \
keys \* | sed 's/.*query=//' | sort -u
View little_es6.js
"use strict";
// Experimenting with ES6 on NodeJS
// node --harmony --harmony_default_parameters ./little_es6.js
var numbers = [1, 1, 2, 5, 3];
var littleSum = numbers.filter(x => x % 2).reduce((s, b) => s + b);
console.log(`Sum is ${littleSum}.`);
numbers.forEach(l => console.log(l));
@otobrglez
otobrglez / RegressionApp.scala
Last active Sep 11, 2018
Linear regression with pure Scala
View RegressionApp.scala
import scala.math.{pow}
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.collection.mutable.ArrayBuffer
object Regression {
def linear(pairs: IndexedSeq[Seq[Double]]) = {
val n = pairs.size
You can’t perform that action at this time.