Skip to content

Instantly share code, notes, and snippets.

View evgenyneu's full-sized avatar

Evgenii Neumerzhitckii evgenyneu

View GitHub Profile
@evgenyneu
evgenyneu / loosing_marbles.py
Created May 21, 2020 05:09
Calculate probability distribution of black marbles in a bag, given observed proportion in the sample form the bag
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def find_posterior(M, N, p, p_hpdi):
"""
We have a bag containing black and white marbles, `M` in total.
We don't know how many black marbles are in the bag.
We take `N` from the bag and count the proportion of black marbles `p`.
@evgenyneu
evgenyneu / yorick.sublime-syntax
Last active November 26, 2018 23:23
Syntax file for Yorick language for Sublime Text 3. Copy the file into "Sublime Text 3/Packages/User/" directory. Credit https://github.com/facelessuser/sublime-languages
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: C/C++(11)
file_extensions:
- i
first_line_match: |-
(?x)
-[*]-( Mode:)? C -[*]-
|
@evgenyneu
evgenyneu / LaTeXSubDir.sublime-build
Created September 11, 2018 09:51
Sublime text build file to build LaTeX in a sub directory
{
"cmd": ["mkdir -p metafiles && /Library/TeX/texbin/pdflatex -output-directory metafiles '$file'"],
"shell": true,
"selector": "text.tex.latex"
}
@evgenyneu
evgenyneu / LaTeX.sublime-build
Last active February 25, 2020 05:19
LaTeX build file for Sublime Text 3 for MacOS. Builds PDF (Command-B) and bibliography (Shift-Command-B).
{
"cmd": ["/Library/TeX/texbin/pdflatex","$file"],
"selector": "text.tex.latex",
"variants": [
{
"name": "Build Bibliography",
"cmd": ["/Library/TeX/texbin/bibtex","$file_base_name"],
}
]
}
@evgenyneu
evgenyneu / Shell
Created December 29, 2016 08:01
Calling rollbar deployment webhook
ACCESS_TOKEN=secret
ENVIRONMENT=production
LOCAL_USERNAME=`whoami`
REVISION=`git log -n 1 --pretty=format:"%H"`
curl https://api.rollbar.com/api/1/deploy/ \
-F access_token=$ACCESS_TOKEN \
-F environment=$ENVIRONMENT \
-F revision=$REVISION \
-F local_username=$LOCAL_USERNAME
@evgenyneu
evgenyneu / LeTeX.sublime-build
Last active October 17, 2021 06:26
A build file Sublime Text 3 that builds a PDF from LaTeX on macOS
{
"cmd": ["/Library/TeX/texbin/pdflatex '$file' && open -a Skim.app '$file_path/$file_base_name.pdf'"],
"shell": true,
"selector": "text.tex.latex"
}
@evgenyneu
evgenyneu / concatenate_swift_files.sh
Last active March 27, 2023 00:35
Concatenates all Swift files into one file. Used in Xcode to build a single swift distributive file. In Xcode it is done by creating an external build tool configuration.
#!/bin/bash
#
# Combines *.swift files into a single file. Used in Xcode to build a single swift distributive file.
#
# Here is how to use it in Xcode:
#
# 1. Create an "External build system" target.
# 2. Click "Info" tab in target settings.
# 3. In "Build Tool" field specify the path to this script file, for example: $PROJECT_DIR/scripts/concatenate_swift_files.sh
@evgenyneu
evgenyneu / AutoCancellingTimer.swift
Last active September 24, 2016 03:08
Auto-cancelling Swift timer.
//
// Creates a timer that executes code after delay. The timer lives in an instance of `AutoCancellingTimer` class and is automatically canceled when this instance is deallocated.
// This is an auto-canceling alternative to timer created with `dispatch_after` function.
//
// Source: https://gist.github.com/evgenyneu/516f7dcdb5f2f73d7923
//
// Usage
// -----
//
// class MyClass {
@evgenyneu
evgenyneu / undo_ios_carthage_except.sh
Last active August 21, 2018 15:23
Undo frameworks built by Carthage except the one given framework
#!/bin/sh
#
# Script for Xcode and Carthage
# ------------------------------
#
# Dismisses changes to all the frameworks except the given frameworks in the iOS build folder.
# This is used to undo the changes done to the framework build after `carthage update` command.
#
#
@evgenyneu
evgenyneu / empty_swift_file_template.sh
Last active September 19, 2016 11:08
Empty Swift file template script
#!/bin/bash
#
# This script makes an empty Swift file template.
#
# Usage:
#
# sudo ./change_xcode_template
#
# or specify the Xcode app name