Instantly share code, notes, and snippets.

View neovim-centos-6.sh
#!/bin/bash
set -e
set -v
# Prerequisites
sudo yum -y install libtool autoconf automake cmake gcc gcc-c++ make pkgconfig unzip gettext
# Installation Folder
mkdir -p ~/opt/src
cd ~/opt/src
# Source
[ -e neovim ] || git clone https://github.com/neovim/neovim.git
View logging_env.py
import logging
LOGLEVEL = os.environ.get('LOGLEVEL', 'INFO').upper()
logging.basicConfig(level=LOGLEVEL)
View Dockerfile
FROM elixir
RUN mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
# install the Phoenix Mix archive
RUN mix archive.install --force https://github.com/phoenixframework/archives/raw/master/phx_new.ez
RUN mix local.hex --force \
&& mix local.rebar --force
# install Node.js (>= 8.0.0) and NPM in order to satisfy brunch.io dependencies # See https://hexdocs.pm/phoenix/installation.html#node-js-5-0-0
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && apt-get install -y inotify-tools nodejs
View main.go
package main
import (
"errors"
"fmt"
"log"
"math/rand"
"net/http"
)
View main.go
package main
import (
"log"
"net/http"
)
type handlers struct{}
func (h *handlers) Middleware(next http.HandlerFunc) http.HandlerFunc {
View AdjustWindowHeight.vim
au FileType qf call AdjustWindowHeight(3, 10)
function! AdjustWindowHeight(minheight, maxheight)
let l = 1
let n_lines = 0
let w_width = winwidth(0)
while l <= line('$')
" number to float for division
let l_len = strlen(getline(l)) + 0.0
let line_width = l_len/w_width
let n_lines += float2nr(ceil(line_width))
View README.md

Total of pip packages downloaded separated by Python versions

From June 26, 2016 (python 3.5.2 release) to Aug. 31, 2016.

Python versions from 2.6 to 3.5

downloads_by_versions

Without 2.7

View moda_media.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# http://docs.python.org/tutorial/datastructures.html
l = [ 1, 10, 4, 2, 4, 3, 3, 1, 1, 3]
print l
promedio = sum(l)/len(l)
View state.js
let createContext = function(firstState) {
let context = {
count: 100,
next: firstState,
};
return function(message) {
context = context.next(message, context);
return context;
};
};
View ToggleNumber.vim
nn <silent> <leader>vn :call ToggleNumber()<CR>
fun! ToggleNumber() "{{{
if exists('+relativenumber')
:exec &nu==&rnu? "setl nu!" : "setl rnu!"
else
setl nu!
endif
endf "}}}