Skip to content

Instantly share code, notes, and snippets.

View krasnobaev's full-sized avatar
👨‍🔬

Aleksey Krasnobaev krasnobaev

👨‍🔬
View GitHub Profile
@krasnobaev
krasnobaev / setup.sh
Last active March 30, 2018 19:46
setup script
#!/bin/bash
apt install -Y git zsh wget openssh
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
echo "set -g @plugin 'tmux-plugins/tpm'" >> ~/.tmux.conf
echo "set -g @plugin 'tmux-plugins/tmux-sensible'" >> ~/.tmux.conf
echo "run '~/.tmux/plugins/tpm/tpm'" >> ~/.tmux.conf
@krasnobaev
krasnobaev / fetchtracks.js
Created February 6, 2017 21:30
work with audio
/*
Trackid – 0 : "456239225"

ownerid – 1 : "212204800"

? – 2 : ""

track name – 3 : "Emotion"

track artist – 4 : "FGFC820"

? – 5 : 313

album id – 6 : 83025823

? – 7 : 0

? – 8 : ""

@krasnobaev
krasnobaev / sapui5.js
Last active October 20, 2017 07:34
sapui5 helpers
$$$=(id)=>sap.ui.getCore().byId(id);
$$$.showModels=o=>(ret={},Object.keys(o.oPropagatedProperties.oModels).map(el=>ret[el]=((o.oPropagatedProperties.oModels[el].getData)?o.oPropagatedProperties.oModels[el].getData():{})),ret);
l = $$$('__item7220');
$$$.showModels(l);
/* */
$$$=(id)=>sap.ui.getCore().byId(id);
$$$.showModels=o=>(
ret={},
FROM ubuntu:16.10
MAINTAINER Aleksey Krasnobaev <https://github.com/krasnobaev>
# https://www.digitalocean.com/community/tutorials/docker-explained-how-to-containerize-python-web-applications
RUN apt-get update ; \
DEBIAN_FRONTEND=noninteractive apt-get -y install python python-dev python-distribute python-pip \
wget git
# following instructions in https://explosion.ai/blog/chatbot-node-js-spacy
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
result = [{a:null,b:2}, {b:4,c:null}];
result.forEach(function (el) {
var keys = Object.prototype.keys(el);
keys.forEach(function (el2) {
if (el[el2] === null) {
delete el[el2];
}
});
});
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// This is CodeMirror (http://codemirror.net), a code editor
// implemented in JavaScript on top of the browser's DOM.
//
// You can find some technical background for some of the code below
// at http://marijnhaverbeke.nl/blog/#cm-internals .
(function(mod) {
function FunctionArray(count) {
var arr = [];
for (var i = 0; i < count; i++) {
var t = {};
t.i = JSON.parse(JSON.stringify(i));
arr[i] = function () {
debugger;
alert(t.i);
}.bind(t);
}
@krasnobaev
krasnobaev / file.sed
Last active June 21, 2016 07:04
MacOS sed patterns
# MacOS sed patterns difference – http://unix.stackexchange.com/a/131940/58019
sed /pattern/,+2d # like `sed '/pattern/{N;N;d;}'`
sed -n 0~3p # like `awk NR%3==0`
sed /pattern/Q # like `awk '/pattern/{exit}1'` or `sed -n '/pattern/,$!p'`
sed 's/\b./\u&/g' # \u converts the next character to uppercase
sed 's/^./\l&/' # \l converts the next character to lowercase
sed -i '1ecat file_to_prepend' file # e executes a shell command
sed -n l0 # 0 disables wrapping
@krasnobaev
krasnobaev / Dialog.fragment.xml
Last active May 19, 2016 18:53
sublime ui5 snippets
<core:FragmentDefinition
xmlns="sap.m"
xmlns:core="sap.ui.core"
>
<SelectDialog
title="Dialog Title"
noDataText="Model not loaded"
search="handleSearch"
liveChange="handleSearch"
confirm="handleDialogApply"