Skip to content

Instantly share code, notes, and snippets.

View kumekay's full-sized avatar

Sergei Silnov kumekay

View GitHub Profile
@kumekay
kumekay / kimsufi_notify.py
Created June 8, 2015 10:36
Kimsufi server Availability checker and notifier (via PushBullet)
import json
import codecs
import requests
import random
def get_states(reference = ["150sk30", "150sk40"]):
states = {}
anyAvailable = False
body = requests.get('https://ws.ovh.com/dedicated/r2/ws.dispatcher/getAvailability2').json()
for r in reference:
@kumekay
kumekay / deploy.rake
Last active August 29, 2015 14:18 — forked from njvitto/deploy.rake
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
PRODUCTION_APP = 'YOUR_PRODUCTION_APP_NAME_ON_HEROKU'
STAGING_APP = 'YOUR_STAGING_APP_NAME_ON_HEROKU'
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
/Users/ku/Desktop/Arduino.app/Contents/Resources/Java/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: /var/folders/q6/zj07wtbs2wscjh0j9z1rg_dm0000gn/T/build1213722952246011698.tmp/fitocube.cpp.elf section `.text' will not fit in region `iram1_0_seg'
/Users/ku/Desktop/Arduino.app/Contents/Resources/Java/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib/libc.a(lib_a-freer.o):(.literal+0x1c): undefined reference to `_sbrk_r'
/Users/ku/Desktop/Arduino.app/Contents/Resources/Java/hardware/tools/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/lib/libc.a(lib_a-freer.o): In function `_malloc_trim_r':
mallocr.c:(.text+0x366): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x38f): undefined reference to `_sbrk_r'
mallocr.c:(.text+0x3a0): undefined reference to `_sbrk_r'
/Users/ku/Desktop/Arduino.app/Contents/Resources/Java/hardware/tools/esp8266/x
--Bluetooth for VirtualBox
--delay 5
set question to display dialog "Manage Bluetooth for ... " buttons {"VirtualBox", "Cancel", "Mac OS"} default button "Cancel" cancel button "Cancel" with icon caution with title "Bluetooth" giving up after 30
set answer to button returned of question
if answer is equal to "VirtualBox" then
-- delay 30
try
# based on
# https://dev.openwrt.org/browser/trunk/target/linux/atheros/base-files/etc/hotplug.d/button/00-button
# https://forum.openwrt.org/viewtopic.php?pid=172110#p172110
. /lib/functions.sh
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
do_button () {
local button
@kumekay
kumekay / 02.make
Last active August 29, 2015 14:01
brew install mlt with xcode 5.1.1
list='src/framework src/mlt++ src/melt src/modules src/swig profiles'; \
for subdir in $list; do \
/Applications/Xcode.app/Contents/Developer/usr/bin/make -s -C $subdir depend || exit 1; \
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C $subdir all || exit 1; \
done
clang: error: unknown argument: '-fno-tree-dominator-opts' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: error: unknown argument: '-fno-tree-pre' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make[1]: *** [depend] Error 1
@kumekay
kumekay / log.js
Created November 17, 2013 12:13
Consone forms
[].forEach.call(document.querySelectorAll('form'), function (input) {
var table = [];
console.group('HTMLForm "' + input.name + '": ' + input.action);
console.log('Element: ', input, '\nName: ' +
input.name + '\nMethod: ' + input.method.toUpperCase() +
'\nAction: ' + input.action || 'null');
['input', 'textarea', 'select'].forEach(function (control) {
[].forEach.call(input.querySelectorAll(control), function (node) {
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
# Nginx+Unicorn best-practices congifuration guide. Now with SPDY!
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@kumekay
kumekay / cron
Created September 26, 2013 07:17
Крон в линуксе запускает программу в пустом окружении. Учитывая, что
сегодня каждое первое приложение идет с rvm или чем-то ещё, а крон обычно
запускается по ночам, отладка занимает кучу времени.
Проще всего отладить так:
env -i /path/to/script.sh
Это воссоздает то бедное окружение, в котором работает крон.