Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Sergei Silnov kumekay

🦀
View GitHub Profile
View 01. Gemfile
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'
@kumekay
kumekay / log.js
Created Nov 17, 2013
Consone forms
View log.js
[].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) {
@kumekay
kumekay / 02.make
Last active Aug 29, 2015
brew install mlt with xcode 5.1.1
View 02.make
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
View 00-button
# 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
View gist:c91c8b6e0907f140454b
--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
View gist:fad36cddff13bbdb66fe
/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
View 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]
@kumekay
kumekay / kimsufi_notify.py
Created Jun 8, 2015
Kimsufi server Availability checker and notifier (via PushBullet)
View kimsufi_notify.py
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 / dokku.sh
Last active Aug 29, 2015
Dokku with plugins installer
View dokku.sh
# Tested on Online.net Ubuntu 14.04-2 x64
sudo apt-get install curl
sudo ssh-keygen -t rsa -b 4096 -C "test@test.test"
wget https://raw.github.com/progrium/dokku/v0.3.18/bootstrap.sh
sudo DOKKU_TAG=v0.3.18 bash bootstrap.sh
# setup dokku plugins
cd /var/lib/dokku/plugins/
sudo git clone https://github.com/ribot/dokku-slack slack
sudo git clone https://github.com/bigboxsoftware/dokku-sidekiq sidekiq
@kumekay
kumekay / sudo_without_password
Created Jun 10, 2015
Sudo without password
View sudo_without_password
RUN:
sudo visudo
ADD LINE:
user_name ALL=(ALL) NOPASSWD: ALL