Skip to content

Instantly share code, notes, and snippets.

View andrey-str's full-sized avatar

Andrey Streltsov andrey-str

View GitHub Profile
@andrey-str
andrey-str / subscribeToEditorHideEvents.coffee
Created June 26, 2016 07:43
Hide/show CKEditor toolbar on focus events
subscribeToEditorHideEvents = (id) ->
CKEDITOR.instances[id].on 'instanceReady', (e) ->
$('#cke_' + id + " [id$='_top']").hide()
$('#cke_' + id + " [id$='_bottom']").hide()
@on 'focus', ->
$('#cke_' + id + " [id$='_top']").show()
$('#cke_' + id + " [id$='_bottom']").show()
@andrey-str
andrey-str / GIF-Screencast-OSX.md
Created July 3, 2016 07:31 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@andrey-str
andrey-str / doc.md
Created July 3, 2016 11:17 — forked from oelmekki/doc.md
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

@andrey-str
andrey-str / qt5-postbuild.cmake
Created July 7, 2016 11:01
Copy Qt5 dlls to app's directory [WINDOWS]
function (add_copy_qt5_postbuild_step MY_APP_NAME MY_APP_BINARY_DIR)
ADD_CUSTOM_COMMAND(
TARGET ${MY_APP_NAME} POST_BUILD
# DEBUG
COMMAND ${CMAKE_COMMAND} -E copy ${Qt5Core_DIR}/../../../bin/libEGLd.dll ${MY_APP_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${Qt5Core_DIR}/../../../bin/libGLESv2d.dll ${MY_APP_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${Qt5Core_DIR}/../../../bin/Qt53DCored.dll ${MY_APP_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${Qt5Core_DIR}/../../../bin/Qt53DExtrasd.dll ${MY_APP_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy ${Qt5Core_DIR}/../../../bin/Qt53DInputd.dll ${MY_APP_BINARY_DIR}
//
// Created by Andrey Streltsov on 11/06/15.
// Based on code from here: http://stackoverflow.com/a/28172162/365754
#include "AppRunGuard.h"
#include <qcryptographichash.h>
namespace
{

KVM OSX Guest 10.11 (El Capitan) with Clover

  • Some notes about this approach:
    • An OSX Installer USB drive for Install OS X El Capitan is created
    • Clover is then installed on the USB drive
    • Clover Configurator is then run on the USB drive
    • The USB drive contents are copied to the VM host
    • VNC is used to connect to the guest UI
  • The qxl virtual video device is used (part of the standard kvm qemu install)
@andrey-str
andrey-str / gist:03f32aab7a228be353c1f34deb065f23
Last active January 13, 2020 11:22
MySQL шпаргалки (основа взята отсюда: https://habrahabr.ru/post/105954/ )

#Работа с бекапами

NB: пароль в командной строке лучше не указывать, если это не крон-like задача, конечно. Ключ -p запрашивает ввод пароля поссле ввода команды.

Делаем бекап

mysqldump -u USER -pPASSWORD DATABASE > /path/to/file/dump.sql

###Создаём структуру базы без данных mysqldump --no-data - u USER -pPASSWORD DATABASE > /path/to/file/schema.sql

#!/bin/bash
# Загружаем модуль ядра Network Block Device
modprobe nbd
# "Подключаем" образ к устройству /dev/nbd0.
qemu-nbd --connect /dev/nbd0 --read-only /путь/к/образу.qcow2
# Ищем разделы на устройстве.
kpartx -arvs /dev/nbd0
@andrey-str
andrey-str / irb.rb
Last active January 10, 2017 09:57
Rasil Cheat Sheets
# Save all records added in IRB console
EntityName.all.each { |entity| entity.save! }
@andrey-str
andrey-str / download_egghead_videos.md
Created November 3, 2017 01:53 — forked from ldong/download_egghead_videos.md
download egghead videos

Download videos from egghead

Go to the egghead website, i.e. Building a React.js App

run

$.each($('h4 a'), function(index, video){
  console.log(video.href);
});