Skip to content

Instantly share code, notes, and snippets.

View romansavrulin's full-sized avatar
❤️
Creating wonderful things

Roman Savrulin romansavrulin

❤️
Creating wonderful things
View GitHub Profile
@romansavrulin
romansavrulin / stdin_stream.hpp
Last active August 29, 2015 14:26 — forked from kikairoya/stdin_stream.hpp
boost::asio AsyncReadStream for console input
class stdin_stream: boost::noncopyable {
typedef boost::function<void (const boost::system::error_code &, size_t bytes_transferred)> read_handler_type;
public:
stdin_stream(boost::asio::io_service &io, HANDLE hin): io(io), hin(hin), hev(CreateEvent(0, 0, 0, 0)), handler(), buffer(0), size(0) {
_beginthread(&stdin_stream::thread_handler_gateway, 0, this);
}
~stdin_stream() {
buffer = 0;
CloseHandle(hev);
}
@romansavrulin
romansavrulin / disk_wipe.sh
Created December 20, 2015 16:21 — forked from Kromey/disk_wipe.sh
This simple Bash script functions as a wrapper around dd, for the purpose of wiping a disk or partition while providing progress feedback to the user.
#!/bin/bash
# disk_wipe.sh
# Author: Kromey (http://kromey.us/)
# This simple Bash script leverages the dd utility to provide user feedback
# as progress is made, designed for the purpose of wiping hard drives or
# partitions. This script reads from /dev/zero to most efficiently zero-out
# the target device or partition.
#
# BEGIN CONFIG
@romansavrulin
romansavrulin / gittruncatehistory.sh
Created January 8, 2018 19:08 — forked from magnetikonline/gittruncatehistory.sh
Truncate Git history to a specific SHA1, dropping everything before it.
#!/bin/bash -e
# Lifted from: https://github.com/adrienthebo/git-tools/blob/master/git-truncate
# Note: seem to be finding the need to run this twice over to commit the truncate
if [[ (-z $1) || (-z $2) ]]; then
echo "Usage: $(basename "$0") <drop before SHA1 commit> <branch>"
exit 1
fi
git filter-branch --parent-filter "sed -e 's/-p $1[0-9a-f]*//'" \
@romansavrulin
romansavrulin / # carthage - 2019-04-10_15-10-24.txt
Created April 10, 2019 12:10
carthage on macOS 10.14.4 - Homebrew build logs
Homebrew build logs for carthage on macOS 10.14.4
Build date: 2019-04-10 15:10:24
@romansavrulin
romansavrulin / multiple_ssh_setting.md
Created July 30, 2019 16:56 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"

git-flow completion requires git-completion to work. How exactly you go about installing git-completion varies wildly from system to system, so it's hard to give exact installation instructions.

OS X / macOS

By far the easiest way to install both Git and git-completion is via Homebrew, so you should pick that one.

Homebrew

  1. Install homebrew
@romansavrulin
romansavrulin / __readme.md
Created August 27, 2019 15:54 — forked from maxivak/__readme.md
Load code in libraries in Rails 5

Load lib files in production (Rails 5)

If you have your code defined in classes in lib/ folder you may have problems to load that code in production.

Autoloading is disabled in the production environment by default because of thread safety.

Change config/application.rb:

    config.autoload_paths << Rails.root.join("lib")
 config.eager_load_paths &lt;&lt; Rails.root.join("lib")
@romansavrulin
romansavrulin / virtual.rb
Created September 2, 2019 13:06 — forked from mssola/virtual.rb
Simple and stupid code to emulate pure virtual methods in Ruby.
##
# This file describes a simple way to implement the idea of pure virtual
# methods (abstract methods in Java, C#,...) in Ruby. Personally, I haven't
# used this pattern while programming in Ruby, but I thought it could be fun.
#
##
# This class provides a fancy way to show an error when a virtual method
# is being used but the subclass hasn't implemented it.
@romansavrulin
romansavrulin / repo-rinse.sh
Created September 16, 2019 14:30 — forked from nicktoumpelis/repo-rinse.sh
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@romansavrulin
romansavrulin / Activate Office 2019 for macOS VoL.md
Created November 24, 2019 20:37 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref