Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Kalygin mkalygin

View GitHub Profile
@mkalygin
mkalygin / install-zsh.sh
Created May 2, 2014
Install zsh on Elementary OS.
View install-zsh.sh
# Source: http://choyan.me/oh-my-zsh-elementaryos/
sudo apt-get update && sudo apt-get install -y curl vim git zsh
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | bash
sudo chsh -s $(which zsh) $(whoami)
@mkalygin
mkalygin / tinypng
Created Sep 13, 2018
This simple batch script compresses PNG and JPEG files with TinyPNG API https://tinypng.com. It depends on jq tool https://stedolan.github.io/jq/.
View tinypng
# Usage:
# ./tinypng <path> <path> ...
#
# Upload the files to shrink and then save them locally under the same name.
# Only works with JPEG and PNG. Accepts wildcard path for batch compression.
#
# Uses TinyPNG API: https://tinypng.com/developers/reference.
# Uses TINYPNG_API_KEY environment variable for TinyPNG API key.
# Depends on jq: https://stedolan.github.io/jq/
@mkalygin
mkalygin / output.txt
Created Apr 5, 2016
Meteor packages for 'Client modified - refreshing' issue
View output.txt
accounts-base@1.2.2
accounts-google@1.0.6
accounts-oauth@1.1.8
accounts-password@1.1.4
accounts-ui@1.1.6
accounts-ui-unstyled@1.1.8
ahref:dragula@3.5.4
aldeed:autoform@5.8.1
aldeed:collection2@2.9.1
aldeed:collection2-core@1.1.1
@mkalygin
mkalygin / log.txt
Created Apr 5, 2016
Meteor log for 'Client modified - refreshing' issue
View log.txt
Opening db file /Users/mkalygin/.meteor/package-metadata/v2.0.1/packages.data.db
Local package version is up-to-date: meteor-tool@1.1.10
Opening db file /Users/mkalygin/.meteor/package-metadata/v2.0.1/packages.data.db
314.00 q [via TOP:commands.js]
48.00 underscore [via TOP:underscore, TOP:console.js, cleanup.js:underscore, profile.js:underscore, TOP:warehouse.js, isopackets.js:underscore, isopackets.js:builder.js, isopackets.js:isopack-cache.js, isopackets.js:package-map.js, TOP:commands.js, TOP:commands-packages.js, TOP:commands-packages-query.js, TOP:commands-cordova.js]
27.00 npmlog [via TOP:warehouse.js, TOP:commands.js]
21.00 TOP
20.00 semver [via TOP:console.js, TOP:warehouse.js, TOP:commands.js, TOP:semver]
20.00 once [via TOP:console.js, TOP:commands.js]
18.00 npm [via TOP:commands.js]
View connect-mongolab
#!/bin/bash
mongoctl connect `heroku config | grep -Po '(?<=MONGOLAB_URI: ).+'`
@mkalygin
mkalygin / add-script.js
Last active Dec 24, 2015
Add Script to DOM
View add-script.js
function addScript(path) {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = path;
document.getElementsByTagName("head")[0].appendChild(script);
}
@mkalygin
mkalygin / miniwidget.js
Last active Dec 21, 2015
jQuery Mini Widget
View miniwidget.js
$.fn.miniwidget = function () {
var self = this;
return $.extend(true, self.each(function () {
var $this = $(self);
// initialization...
}), {
method: function () {
return self.each(function () {
var $this = $(this);
@mkalygin
mkalygin / submodule.js
Created Aug 2, 2013
JavaScript submodule with jQuery.
View submodule.js
var Module = (function (Module, window, $) {
var SubModule = Module.SubModule = Module.SubModule || {};
$.extend(SubModule, {
initialize: function () {
}
});
return Module;
}(Module || {}, window, jQuery));
@mkalygin
mkalygin / acmp_template.c
Last active Aug 29, 2015
ACMP C Program Template (http://acmp.ru/)
View acmp_template.c
#include <stdio.h>
const bool FILE_IO = false;
int main() {
if (FILE_IO) {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
}