Skip to content

Instantly share code, notes, and snippets.

View otobrglez's full-sized avatar
🏗️
Building.

Oto Brglez otobrglez

🏗️
Building.
View GitHub Profile
@otobrglez
otobrglez / Boot5.scala
Created November 7, 2019 13:03
Odd Slick streams
package com.examples.streaming_one
import akka.Done
import akka.actor.ActorSystem
import akka.stream._
import akka.stream.scaladsl._
import slick.jdbc.JdbcBackend.Database
import slick.jdbc.PostgresProfile.api._
import slick.jdbc.{ResultSetConcurrency, ResultSetType}
@otobrglez
otobrglez / car.rb
Created August 23, 2011 12:26
Experimenting with observer pattern (publish/subscribe pattern) in Ruby
# Simple Car class. Nothing special here...
class Car
attr_accessor :brand
attr_accessor :model
attr_accessor :year
def initialize(brand, model, year=2011)
@brand, @model, @year = brand, model, year
end
@otobrglez
otobrglez / RegressionApp.scala
Last active September 11, 2018 17:14
Linear regression with pure 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
@otobrglez
otobrglez / pg_optimisation.sql
Last active March 28, 2018 13:39
Optimising N+1 problem in PG with "json_agg"
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 March 21, 2018 16:37
Transforming yaml to another yaml.
header:
label: 'Header'
breakpoint:
fallback:
name: header_fallback
label: 'Header @ fallback (306 x 172)'
width: 306
height: 172
small:
name: header_small
@otobrglez
otobrglez / spam.txt
Created December 5, 2017 12:32
Slovenia SPAM
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 October 19, 2017 13:23
Bash script for syncing WordPress theme to FlyWheel (sftp with lftp)
#!/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 / dropbox.rake
Created August 25, 2011 10:01
Rake task for moving Heroku PostgreSQL backups to Dropbox (Rails)
# By Oto Brglez - @otobrglez
# Rake task. Put in your (lib/tasks) folder of your Rails application
# Execute with "rake dropbox:backup"
# Configuration must be inside config/dropbox.yml file
namespace :dropbox do
desc "Backup production database to dropbox"
task :backup do
@otobrglez
otobrglez / REPORT.md
Created May 19, 2017 12:28
arp-scan / arp-fingerprint "bomb"

Problem && how to replicate?

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

Output:

#!/usr/bin/env python
from pprint import pprint
servers = {
"0.0.1.1": {
"status": "OK"
},
"0.0.1.2": {
"status": "ERROR"