Skip to content

Instantly share code, notes, and snippets.

@anton-matosov
anton-matosov / commit-msg
Last active September 7, 2015 02:41
git commit-msg hook to put JIRA ticket ID (or other ID matching pattern) in front of the message
#!/bin/sh
#
# Automatically adds JIRA ticket ID based on branch name to every commit message.
#
set -x
MESSAGE=$(cat "$1")
BASEREGEX="([A-Z]{1,10}-[0-9]*)"
MSG_REGEX=$BASEREGEX
if [[ $MESSAGE =~ $MSG_REGEX ]]
@anton-matosov
anton-matosov / Podfile
Last active December 26, 2015 22:57
Podfile post_install hack which removes the beta suffix from version in info.plist to fix AppStore validation
# Podfile post_install hack which removes the beta suffix from version in info.plist to fix AppStore validation
# Credit to jerolimov comment https://github.com/ReactiveX/RxSwift/issues/206#issuecomment-158074615
post_install do |installer|
plist_buddy = "/usr/libexec/PlistBuddy"
installer.pods_project.targets.each do |target|
plist = "Pods/Target Support Files/#{target}/Info.plist"
original_version = `#{plist_buddy} -c "Print CFBundleShortVersionString" "#{plist}"`.strip
changed_version = original_version[/(\d+\.){1,2}(\d+)?/]
unless original_version == changed_version
puts "Fix version of Pod \"#{target}\": #{original_version} => #{changed_version}"
@anton-matosov
anton-matosov / HashFromCGRect.m
Last active February 10, 2016 15:25 — forked from steipete/gist:6133152
Create a hash from a CGRect
NSUInteger PSPDFHashFromCGRect(CGRect rect) {
return (*(NSUInteger *)&rect.origin.x << 10 ^ *(NSUInteger *)&rect.origin.y) + (*(NSUInteger *)&rect.size.width << 10 ^ *(NSUInteger *)&rect.size.height);
}
@anton-matosov
anton-matosov / synchronizing-rotation-animation-part-2.m
Created July 6, 2016 00:37 — forked from smnh/synchronizing-rotation-animation-part-2.m
Synchronizing rotation animation between the keyboard and the attached view - Part 2
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardWillChangeFrame:)
name:UIKeyboardWillChangeFrameNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
Updating xcode-install
Fetching: xcode-install-2.2.1.gem (100%)
/Users/antonmatosov/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/xcode-install-2.2.1/bin/🎉 maybe `gem pristine xcode-install` will fix it?
Successfully installed xcode-install-2.2.1
antonmatosov@Antons-MBP ~/> gem pristine xcode-install
Restoring gems to pristine condition...
/Users/antonmatosov/.rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/xcode-install-2.1.1/bin/🎉 maybe `gem pristine xcode-install` will fix it?
@anton-matosov
anton-matosov / React Native Easings
Last active February 1, 2023 13:07 — forked from dabit3/React Native Easings
React Native Easing animations
// https://snack.expo.io/HynFGjcyf
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Easing,
Animated,
// Button,
@anton-matosov
anton-matosov / ParticlesPlot.py
Last active February 13, 2020 11:08
Animated Particles Visualizer Implementation (usage instructions in the comment below)
import numpy as np
# import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
from matplotlib import animation, rc
from IPython.display import HTML, Image
import seaborn # for background grid
seaborn.set()
@anton-matosov
anton-matosov / use-local-sh.sh
Created February 18, 2018 06:51 — forked from dtaskoff/use-local-sh.sh
A script used for modifying the ghc's scripts installed by stack, so that they use a local sh executable
stackargs=$@
shbin="$(which sh)"
if [ -z "$shbin" ] || [[ "$shbin" =~ "not found" ]]; then
echo "Couldn't find sh, exiting."
exit 1
else
echo "Found sh: $shbin"
fi
$ pandoc -s -f markdown -t man README.md | man -l -
$ pandoc -s -f markdown -t html README.md |lynx -dump -stdin | less -
I've tested it on Fedora 23 and Ubuntu 16.04. I'm using gcc-5.3.1, python-3.4, VS Code-1.14.0
You can debug mixed Python/C++ in the same GUI. It also works for MPI applications. You can switch between the debuggers and corresponding call stacks.
1. Packages needed
1) Visual Studio Code
2) Extensions for VS Code:
"Python" from Don Jayamanne (I'm using 0.6.7)
This allows VS Code act as the front end to debug python.
This gives VS Code ability to attach to a python script that uses module "ptvsd".