Skip to content

Instantly share code, notes, and snippets.

View ivarprudnikov's full-sized avatar
🌍
Vivamus, moriendum est.

Ivar (aɪvɑr) ivarprudnikov

🌍
Vivamus, moriendum est.
View GitHub Profile
@ivarprudnikov
ivarprudnikov / node.conf
Last active December 14, 2015 13:38
upstart node.conf for launching node app with npm and installing dependencies on amazon ubuntu ami
# /etc/init/node.conf
description 'node.js app production'
author 'ivarprudnikov.com'
env NAME=app-name
env ENV=production
env PORT=8080
env LOG_FILE=/var/log/app-name.log
env USER=ubuntu
env NPM_BIN=/usr/bin/npm
env APP_LOCATION=/var/www/thisismyapp
#! /bin/bash
#chkconfig: 2345 95 20
#description: iptables rules to prevent communication on unused ports.
IPT=/sbin/iptables
#Reset all rules (F) and chains (X), necessary if have already defined iptables rules
$IPT -F
#Start by blocking all traffic, this will allow secured, fine grained filtering
@ivarprudnikov
ivarprudnikov / aws_ubuntu_ami_user_data.sh
Created March 8, 2013 00:25
AWS Ubuntu ami user data to init instance. Installs node.js, creates upstart script and runs it.
#!/bin/bash
# install node.js
apt-add-repository -y ppa:chris-lea/node.js
apt-get update
apt-get install -y python-software-properties nodejs npm git make g++
# install girror (https://github.com/eladb/node-girror)
npm install -g girror
@ivarprudnikov
ivarprudnikov / debug.conf
Created March 8, 2013 00:29
upstart script for debugging events
# /etc/init/debug.conf
start on ( starting JOB!=debug \
or started JOB!=debug \
or stopping JOB!=debug \
or stopped JOB!=debug )
script
exec 1>>/tmp/upstart_debug_log.file
echo -n "$UPSTART_JOB/$UPSTART_INSTANCE ($0):$$:`date`:"
echo "Job $JOB/$INSTANCE $UPSTART_EVENTS. Environment was:"
env
@ivarprudnikov
ivarprudnikov / gist:5899280
Created July 1, 2013 08:35
Example of grails form remote and onLoading event
<!DOCTYPE html>
<html>
<head>
<meta name="layout" content="main"/>
<title>Homepage</title>
</head>
<body>
<g:formRemote dojoType="dijit.form.Form" method="post"
onLoading="myFunction()" id="submitForm" update="resultset"
@ivarprudnikov
ivarprudnikov / IsRemoteLocalhost
Created July 16, 2013 11:00
Grails check if remote is localhost
def isLocalhost(String ip) {
def localIps = []
def networkInterfaces
try {
networkInterfaces = NetworkInterface.getNetworkInterfaces()
networkInterfaces = networkInterfaces?.toList()
} catch(SocketException e) {
}
(function(undefined, angular, Hammer, $){
"use strict";
angular.module('com.ivarprudnikov.ng.youtube',['LocalStorageModule'])
.config(['localStorageServiceProvider', function(localStorageServiceProvider){
localStorageServiceProvider.setPrefix('yt_prefs');
}]);
@ivarprudnikov
ivarprudnikov / gist:ae2bbaaae80aa60a1eb2
Created October 10, 2014 00:01
Streaming MxPEG from Mobotix IP camera via VLC
// hepful links
https://wiki.videolan.org/MxPEG/
http://stackoverflow.com/questions/1735933/streaming-via-rtsp-or-rtp-in-html5
http://en.wikipedia.org/wiki/Internet_media_type
http://www.videolan.org/doc/videolan-howto/en/ch09.html
http://www.videolan.org/doc/streaming-howto/en/ch03.html
http://www.mobotix.com/eng_GB/Support/User-Forum/Applications/Putting-Mobotix-live-video-stream-on-a-Web-site-How-To
http://www.linuxquestions.org/questions/linux-desktop-74/how-to-stream-a-webcam-to-http-with-vlc-929319/
@ivarprudnikov
ivarprudnikov / gist:76d2fbd6b1015720fba8
Created February 10, 2015 21:50
Arduino Uno + Adafruit SSD1306 - etch a sketch
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// If using software SPI (the default case):
#define OLED_MOSI 9 // data
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
@ivarprudnikov
ivarprudnikov / README.md
Last active August 29, 2015 14:15
OSX Mongodb setup

Mongodb on Mac OSX

Download/setup mongodb

  • curl -O http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.6.7.tgz
  • cd /usr/share
  • sudo mkdir mongodb
  • chown -Rv {username} mongodb
  • cd mongodb
  • tar -zxvf ~/Downloads/mongodb-osx-x86_64-2.6.7.tgz