Skip to content

Instantly share code, notes, and snippets.

View brodul's full-sized avatar

Andraz Brodnik brodul

View GitHub Profile
@brodul
brodul / check.py
Last active August 29, 2015 13:59
ossec check
import os, time
root_log_dir = "/opt/ossec/logs/alerts"
months = [
(1, 'January'),
(2, 'February'),
(3, 'March'),
(4, 'April'),
(5, 'May'),
@brodul
brodul / pipa_lcd
Created April 25, 2014 20:59
Arduino lcd
// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
void write_rows(String line1, String line2) {
lcd.clear();
lcd.setCursor(0, 0);
---
- hosts: tag_test
gather_facts: False
sudo: yes
vars:
- app_user: "pikapika"
- app_user_home: "/srv/{{ app_user }}"
- current_app_dir: "{{ app_user_home }}/engine/current/"
tasks:
- user: name={{ app_user }} comment="{{ app_user }} App User" home={{ app_user_home }}
PLAY [tag_test] ***************************************************************
TASK: [user name=pikapika comment="pikapika App User" home=/srv/pikapika] *****
<107.167.182.70> ESTABLISH CONNECTION FOR USER: brodul
<107.167.182.70> REMOTE_MODULE user name=pikapika comment="pikapika App User" home=/srv/pikapika
<107.167.182.70> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/brodul/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', u'107.167.182.70', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1398764093.06-227944966233568 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1398764093.06-227944966233568 && echo $HOME/.ansible/tmp/ansible-tmp-1398764093.06-227944966233568'"]
<107.167.182.70> PUT /tmp/tmpdVFDvZ TO /home/brodul/.ansible/tmp/ansible-tmp-1398764093.06-227944966
GLAVNICA, glavnica = 6000, 6000
for each in range(12):
obresti = glavnica * (0.2 + each * 0.15) * 30 / 360 / 100
glavnica += obresti
print
print glavnica
print glavnica - GLAVNICA
@brodul
brodul / wallpaper_script.py
Created April 20, 2015 11:55
Wallpaper script
from urllib import urlretrieve
import collections
import hashlib
import json
import os
import pickle
import urllib2
url = "http://www.reddit.com/r/wallpapers/.json?limit=100"
url_cache = '/home/brodul/.wallpaper_cache'
@brodul
brodul / pushup.sh
Last active August 29, 2015 14:26
100 pushup challange shell script
###
# 100 pushup challange shell script
#
# Dependencies:
# - alsa
# - alsa-tools
# - espeak
#
###
#!/bin/sh
set -e
npm install
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"
# how to parse an ini file in bash :D
python3 - <<END
import configparser
#!/bin/bash
# this is runned as backup_user
# the user is in the backup group
# Add key
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s`
ssh-add
fi
@brodul
brodul / config.nix
Last active September 5, 2015 20:11
{
packageOverrides = pkgs: rec {
atom =
with pkgs;
let
atomEnv = buildEnv {
name = "env-atom";
paths = [