Skip to content

Instantly share code, notes, and snippets.

View vladborovtsov's full-sized avatar
🎯
Focusing

Vlad Borovtsov vladborovtsov

🎯
Focusing
View GitHub Profile
@vladborovtsov
vladborovtsov / mount_qcow2.md
Created November 21, 2023 11:47 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@vladborovtsov
vladborovtsov / ddcavcontrol.init.lua
Last active November 14, 2022 14:38 — forked from waydabber/ddcavcontrol.init.lua
Hammerspoon script to control a Display via DDC (brighness, volume) and a Yamaha AV (network) using standard Mac keyboard with MacOS OSD; Modified: don't intercept events when active display is builtin retina
-- ddcavcontrol
-- v1.2.1
-- This Hammerspoon script is intended to do the following:
-- 1) Control External Display Brightness via DDC (utilizing a proper brightness+contrast curve)
-- 2) Control External Display Volume via DDC
-- 3) Control Digital AV Volume via Network (currently works with Yamaha AVs)
-- 4) Use the standard brightness and volume keys of an Apple keyboards
-- 5) Display the standard MacOS OSD as expected
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="together">
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
<objectAnimator
android:valueFrom="1.0" android:valueTo="1.15"
android:valueType="floatType" android:propertyName="scaleX" android:duration="133"/>
<objectAnimator
android:valueFrom="1.15" android:valueTo="0.75"
android:valueType="floatType" android:propertyName="scaleX" android:duration="201"/>
@vladborovtsov
vladborovtsov / stroke_appear_animator.xml
Created June 25, 2017 07:14
fade in/out using object animator
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
<objectAnimator android:propertyName="alpha"
android:duration="200"
android:valueFrom="1.0"
android:valueTo="0.0"
android:valueType="floatType" />
<objectAnimator android:propertyName="alpha"
android:duration="200"
android:valueFrom="0.0"
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially">
<alpha android:fromAlpha="1.0" android:toAlpha="0.5" android:duration="20" />
<alpha android:fromAlpha="0.5" android:toAlpha="0.04" android:duration="20" />
<alpha android:fromAlpha="0.04" android:toAlpha="0.8" android:duration="20" />
<alpha android:fromAlpha="0.8" android:toAlpha="0.0" android:duration="20" />
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="20" />
<alpha android:fromAlpha="1.0" android:toAlpha="0.01" android:duration="40" />
@vladborovtsov
vladborovtsov / flash_anim_attempt.xml
Created June 25, 2017 04:44
Flash Animation (Android)
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha android:fromAlpha="1.0" android:toAlpha="0.5" android:duration="20" android:startOffset="0"/>
<alpha android:fromAlpha="0.5" android:toAlpha="0.04" android:duration="20" android:startOffset="20"/>
<alpha android:fromAlpha="0.04" android:toAlpha="0.8" android:duration="20" android:startOffset="40"/>
<alpha android:fromAlpha="0.8" android:toAlpha="0.0" android:duration="20" android:startOffset="60"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="20" android:startOffset="80"/>
<alpha android:fromAlpha="1.0" android:toAlpha="0.01" android:duration="40" android:startOffset="100"/>
@vladborovtsov
vladborovtsov / NSImage+OpenCV.h
Created June 16, 2017 03:30 — forked from dominiklessel/NSImage+OpenCV.h
NSImage to cv::Mat and vice versa
//
// NSImage+OpenCV.h
//
#import <AppKit/AppKit.h>
@interface NSImage (NSImage_OpenCV) {
}
@vladborovtsov
vladborovtsov / mongodb.conf
Created July 29, 2016 10:04 — forked from ehazlett/mongodb.conf
MongoDB supervisor config
[program:mongodb]
command=/opt/mongodb/bin/mongod --dbpath /storage/mongodb_data --rest
directory=/opt/mongodb
user=root
autostart=false

#MongoDB 3.2.x Replica Sets on AWS EC2 A MongoDB replica set provides a mechanism to allow for a reliable database services. The basic replica set consists of three servers, a primary, a secondary and an arbitrator. The primary and secondary both hold a copy of the data. The arbitrator is normally a low spec server which just monitors the other servers and help with the failover process. In production, there can be more than three servers.

To setup mongo as a replica set on Amazon Web Services EC2 you need to first setup a security group with ssh on port 22 and mongodb on port 27017. You then need to create three servers. Select Ubuntu 14.04 LTS x64 and a micro (or bigger depending on your database size, ideally you should have enough memory to match your database size) instance for the primary and secondary and a nano instance for the arbitrator.

##Adjust the File System on each Server The operating system by default will update the last access time on a file. In a high data throughput database application

@vladborovtsov
vladborovtsov / s3.sh
Created July 17, 2016 11:30 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1