Skip to content

Instantly share code, notes, and snippets.

View yurinnick's full-sized avatar
🏠
Working from home

Nikolay Yurin yurinnick

🏠
Working from home
View GitHub Profile
@yurinnick
yurinnick / oracle_jdk_install.sh
Last active December 19, 2015 09:09
Oracle JDK6u45 download & install
#!/bin/bash
URL="http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64-rpm.bin"
NAME="`basename ${URL}`"
wget --no-cookies --header 'Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com' --no-check-certificate ${URL} -O ${NAME}
chmod +x ${NAME}
./${NAME}
@yurinnick
yurinnick / get_ip.sh
Created July 16, 2013 07:51
Get IP address
#!/bin/bash
ip addr show | tail -n3 | head -n1 | cut -d' ' -f6 | cut -d'/' -f1
@yurinnick
yurinnick / recipe.rb
Created November 9, 2013 09:30 — forked from peplin/recipe.rb
# Source accepts the protocol s3:// with the host as the bucket
# access_key_id and secret_access_key are just that
s3_file "/var/bulk/the_file.tar.gz" do
source "s3://your.bucket/the_file.tar.gz"
access_key_id your_key
secret_access_key your_secret
owner "root"
group "root"
mode 0644
end
@yurinnick
yurinnick / run.js
Created November 29, 2013 13:28
Description: nodejs run specified file with specified interpretator(http://localhost:8000/run?cmd=[python/ruby]&file=[filepath])
var express = require('express');
var app = express();
function execute(inter, file, callback) {
var spawn = require('child_process').spawn;
var command;// = spawn('/usr/bin/python', [ file ]);
switch(inter) {
case "python":
command = spawn("/usr/bin/python", [ file ]);
break;
@yurinnick
yurinnick / python_test_file
Last active December 29, 2015 20:49
test
from decimal import *
#Sets decimal to 25 digits of precision
getcontext().prec = 25
def factorial(n):
if n<1:
return 1
else:
return n * factorial(n-1)
import lucene
from org.apache.lucene.store import SimpleFSDirectory
from org.apache.lucene.analysis import Analyzer
from org.apache.lucene.analysis.core import SimpleAnalyzer, LowerCaseFilter
from org.apache.lucene.analysis.synonym import SynonymFilter, \
WordnetSynonymParser
from org.apache.lucene.analysis.standard import StandardAnalyzer, \
ClassicTokenizer, StandardFilter
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
@yurinnick
yurinnick / gist:d535818a48588932d266
Created December 17, 2014 22:46
Method generation
%w(get post put delete).each do |http_method|
define_singleton_method(http_method.to_sym) do |path, *args|
RestClient::Resource.new("#{Qubell.configuration.endpoint}/api/" \
"#{Qubell.configuration.api_version}#{path}",
Qubell.configuration.username,
Qubell.configuration.password)
.send(http_method.to_sym, *args) do |response|
handle_response(response)
end
end
#!/usr/bin/python
import sys
import cmd
import json
import time
class InteractiveOrCommandLine(cmd.Cmd):
def do_init(self, _args):
zk:
image: bobrik/zookeeper
ports:
- 2181:2181
environment:
ZK_CONFIG: tickTime=2000,initLimit=10,syncLimit=5,maxClientCnxns=128,forceSync=no,clientPort=2181
ZK_ID: 1
master:
image: mesosphere/mesos-master:0.26.0-0.2.145.ubuntu1404