Skip to content

Instantly share code, notes, and snippets.

View sfate's full-sized avatar
πŸ‡ΊπŸ‡¦
Glory to Ukraine, Glory to the Nation, fuck the russian federation! :feelsgood:

Oleksii Bobyriev sfate

πŸ‡ΊπŸ‡¦
Glory to Ukraine, Glory to the Nation, fuck the russian federation! :feelsgood:
View GitHub Profile
@sfate
sfate / colors.js
Created March 31, 2016 13:24
Set lighten/darken hex/rgb color
'use strict';
var Color = function(color, isHex) {
this.color = color;
this.isHex = isHex;
}
Color.prototype = {
rgbToHsl: function(r, g, b) {
r /= 255, g /= 255, b /= 255;
@sfate
sfate / colors.js
Created March 31, 2016 13:23
Set lighten/darken hex/rgb color
'use strict';
var Color = function(color, isHex) {
this.color = color;
this.isHex = isHex;
}
Color.prototype = {
rgbToHsl: function(r, g, b) {
r /= 255, g /= 255, b /= 255;
@sfate
sfate / setup-ctags.sh
Last active March 21, 2016 16:34
basic ctags install
brew install ctags
echo 'alias ctags="`brew --prefix`/bin/ctags"' >> ~/.bashrc
cat <<EOT >> ~/.ctags
--recurse=yes
--exclude=.git
--exclude=vendor/*
--exclude=node_modules/*
--exclude=db/*
--exclude=log/*
@sfate
sfate / currency_convert.js
Created March 8, 2016 20:47
Convert currency for gamersgate site
(function() { 'use strict';
var recalculatePrices = function() {
var rateCurrency = 'RUB_USD';
var rateURL = 'http://free.currencyconverterapi.com/api/v3/convert?q='+rateCurrency+'&compact=y&callback=?';
$.getJSON(rateURL)
.success(function(data) {
var rate = data[rateCurrency].val;
$('.rubl').parent().each(function(i, el) {

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@sfate
sfate / 01.js
Created August 14, 2014 19:57 — forked from martinaglv/01.js
function whatDoesItDo(val){
return val ? 1 : 2;
}

Setup Mac OS X

I'm in a hospital in Spain and my MacBook was stolen.

Hospital Commit

Now I bought a new one and need to configure it. I have an external hard drive that backup everything using Time Machine, but I don't want all the crap I had in the old one.

1. Run Software Update

@sfate
sfate / gist:8543521
Created January 21, 2014 16:45
Install NodeJS on the RaspberryPi
sudo apt-get update
wget http://nodejs.org/dist/v0.10.2/node-v0.10.2-linux-arm-pi.tar.gz
tar -xvzf node-v0.10.2-linux-arm-pi.tar.gz
[[ ! -f .bash_profile ]] && echo '[[ -f .bashrc ]] && . .bashrc' > .bash_profile
echo 'NODE_JS_HOME=/home/pi/node-v0.10.2-linux-arm-pi' >> .bash_profile
echo 'PATH=$PATH:$NODE_JS_HOME/bin' >> .bash_profile
npm install -g node-gyp
@sfate
sfate / gist:6999773
Last active December 25, 2015 15:39
ConfigureVPS

ConfigureVPS

  1. Add new user

$ sudo useradd -m -s {{name}}
$ sudo passwd {{name}} # without password user is blocked
@sfate
sfate / gist:6586031
Last active December 23, 2015 05:19
Recover opengl for ati-cards at *-debian based systems..
sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev* xorg-driver-fglrx
sudo apt-get remove --purge xserver-xorg-video-ati xserver-xorg-video-radeon
sudo apt-get install --reinstall libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core xserver-xorg-video-radeon xserver-xorg-video-ati
sudo apt-get install mesa-utils