Skip to content

Instantly share code, notes, and snippets.

@andrei15
andrei15 / CryptoKitties.sol
Created June 7, 2019 09:05 — forked from yogin/CryptoKitties.sol
CryptoKitties
// Copied from: https://ethfiddle.com/09YbyJRfiI
// CryptoKitties Source code
// Copied from: https://etherscan.io/address/0x06012c8cf97bead5deae237070f9587f8e7a266d#code
pragma solidity ^0.4.11;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
@andrei15
andrei15 / elasticsearch.yml
Created October 3, 2018 07:43 — forked from ignasio/elasticsearch.yml
elasticsearch config for russian morphology based on hunspell
index:
number_of_shards: 3
number_of_replicas: 0 # not for production
analysis:
char_filter:
ru:
type: mapping
mappings: ['Ё=>Е', 'ё=>е']
analyzer:
ru_RU:
@andrei15
andrei15 / rules-both.iptables
Created April 28, 2018 12:57 — forked from jirutka/rules-both.iptables
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <[email protected]>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@andrei15
andrei15 / rename-camel-to-dash.js
Created March 19, 2018 04:20 — forked from finalclass/rename-camel-to-dash.js
recursively renames every file and directory in the script path from camelCase and UpperCamelCase to dash-case
/*jshint node:true*/
'use strict';
/**
* This scripts recursively renames every file and directory in the script path
* from camelCase and UpperCamelCase to dash-case
*
* Do a backup before executing this script
*
* @lecense MIT
@andrei15
andrei15 / clean_audio.sh
Created February 13, 2018 13:54 — forked from devoncrouse/clean_audio.sh
Using Sox (http://sox.sourceforge.net) to remove background noise and/or silence from audio files (individually, or in batch).
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
@andrei15
andrei15 / transcribe.js
Created January 14, 2018 17:47 — forked from antiboredom/transcribe.js
Transcribe video/audio using IBM Watson
var request = require('request');
var fs = require('fs');
var sox = require('sox');
var spawn = require('child_process').spawn;
var WATSON_USER = '';
var WATSON_PASS = '';
var url = 'https://stream.watsonplatform.net/speech-to-text/api/v1/recognize';
@andrei15
andrei15 / Ubuntu12.04-g++4.8
Created April 14, 2016 07:11 — forked from akoluthic/Ubuntu12.04-g++4.8
Install g++ 4.8 on Ubuntu 12.04
*Add the toolchain/test PPA*
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
*If you ever want to update symlinks for a future version:*
sudo rm /usr/bin/g++
sudo ln -s /usr/bin/g++-4.XXX /usr/bin/g++
@andrei15
andrei15 / mongodb-upstart.sh
Created December 3, 2015 10:23 — forked from onedesign/mongodb-upstart.sh
Ubuntu upstart script for MongoDB with automatic repair
# Ubuntu upstart file at /etc/init/mongodb.conf
pre-start script
mkdir -p /var/lib/mongodb/
mkdir -p /var/log/mongodb/
end script
start on runlevel [2345]
stop on runlevel [06]
var mongoose = require('./../mongoose');
var Schema = mongoose.Schema;
var sleep = 1000;
var timer;
var db = mongoose.createConnection();
db.on('error', function () {
// error on startup
console.error('conn error', arguments);
requests.put('http://localhost:9200/site/', data=json.dumps({
'settings': {
'analysis': {
'analyzer': {
'ru': {
'type': 'custom',
'tokenizer': 'standard',
"filter": ['lowercase', 'russian_morphology', 'english_morphology', 'ru_stopwords'],
},
},