Skip to content

Instantly share code, notes, and snippets.

sdcsdcsd
@AndrewVos
AndrewVos / .vimrc
Last active August 29, 2015 14:07
Use the :G <tab> command in vim to list files that have been modified in a git repository
if !empty(glob(".git"))
function! GitLsFilesModified(A,L,P)
let pattern = a:A
if len(pattern) > 0
return split(system("git ls-files --untracked --modified \| grep " . pattern), "\n")
else
return split(system("git ls-files --untracked --modified"), "\n")
endif
endfunction
command! -complete=customlist,GitLsFilesModified -nargs=1 G :edit <args>
if !empty(glob(".git"))
function! GitLsFiles(A,L,P)
let pattern = a:A
if len(pattern) > 0
return split(system("git ls-files \| grep " . pattern), "\n")
else
return split(system("git ls-files"), "\n")
endif
endfunction
command! -complete=customlist,GitLsFiles -nargs=1 Z :edit <args>
@AndrewVos
AndrewVos / fix.rb
Created September 24, 2014 22:02
bash-vulnerability
# ip addresses
servers = [
"1.1.1.1"
]
user = "ubuntu"
servers.each do |server|
puts server
system "scp -q -p test-for-vulnerability #{user}@#{server}:~"
if !empty(glob(".git"))
function! GitLsFiles(A,L,P)
let pattern = a:A
if len(pattern) > 0
return split(system("git ls-files \| grep " . pattern), "\n")
else
return split(system("git ls-files"), "\n")
endif
endfunction
command! -complete=customlist,GitLsFiles -nargs=1 Z :edit <args>
with("#{ENV['HOME']}/test_history", 'a', 0600).
FROM ubuntu:latest
RUN apt-get update -y
RUN apt-get install -y wget make git
RUN wget --no-check-certificate -O ruby-install-0.4.3.tar.gz https://github.com/postmodern/ruby-install/archive/v0.4.3.tar.gz
RUN tar -xzvf ruby-install-0.4.3.tar.gz
RUN cd ruby-install-0.4.3 && make install && cd .. && rm -rf ruby-install-0.4.3
RUN ruby-install -i /usr/local ruby 2.1.2
RUN gem install --no-rdoc --no-ri bundler
function! GitLsFiles(A,L,P)
let pattern = a:A
if len(pattern) > 0
return split(system("git ls-files \| grep " . pattern), "\n")
else
return split(system("git ls-files"), "\n")
endif
endfunction
command -complete=customlist,GitLsFiles -nargs=1 Z :edit <args>
func RequestCreateProductIndex() error {
mappings := `
{
"mappings":{
"product":{
"properties":{
"name":{"type":"string","analyzer":"snowball"},
"price":{"type":"double","index":"not_analyzed"},
"saleprice":{"type":"double","index":"not_analyzed"},
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", CreateHandler)
http.ListenAndServe(":8000", nil)