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 / UIImageView+CoordinateTransform.h
Last active May 5, 2018 12:36
Convert UIImageView coordintate to UIImage pixel coordinate and back turn around. Borrowed from here: http://b2cloud.com.au/tutorial/uiimageview-transforming-touch-coordinates-to-pixel-coordinates/
//
// Created by Andrey Streltsov on 16/11/15.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UIImageView (CoordinateTransform)
-(CGPoint) pixelPointFromViewPoint:(CGPoint)viewPoint;
-(CGPoint) viewPointFromPixelPoint:(CGPoint)pixelPoint;
#!/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 / 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);
});
@andrey-str
andrey-str / ape2mp3.sh
Created January 6, 2016 09:08 — forked from jingle/ape2mp3.sh
Convert ape to mp3 using avconv, split with mp3splt and cue
#!/bin/bash
find "$1" -type f -name "*.ape" -print0 | while read -d $'\0' song
do
output=${song%.ape}.mp3
cue=${song%.ape}.cue
avconv -i "$song" -b 192k "$output"
if ls "$cue" &> /dev/null; then
mp3splt -a -c "$cue" "$output"
@andrey-str
andrey-str / NSLog+Additions.h
Last active February 12, 2017 14:20
NSLogging helpers [Macroses]
#ifndef __NSLOG_ADDITIONS_H__
#define __NSLOG_ADDITIONS_H__
// DLog will output like NSLog only when the DEBUG variable is set
#ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
# define DLog(...)
#endif
@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! }

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 / 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}
@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 / 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: