Skip to content

Instantly share code, notes, and snippets.

View .vimrc
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 Sep 24, 2014
bash-vulnerability
View fix.rb
# ip addresses
servers = [
"1.1.1.1"
]
user = "ubuntu"
servers.each do |server|
puts server
system "scp -q -p test-for-vulnerability #{user}@#{server}:~"
View .vimrc
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>
View history_spec.rb
with("#{ENV['HOME']}/test_history", 'a', 0600).
View Dockerfile
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
View .vimrc
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>
View ingest.go
func RequestCreateProductIndex() error {
mappings := `
{
"mappings":{
"product":{
"properties":{
"name":{"type":"string","analyzer":"snowball"},
"price":{"type":"double","index":"not_analyzed"},
"saleprice":{"type":"double","index":"not_analyzed"},
View meh.go
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", CreateHandler)
http.ListenAndServe(":8000", nil)
View test_test.go
func captureStdout(f func()) string {
tempFile, _ := ioutil.TempFile("", "stdout")
oldStdout := os.Stdout
os.Stdout = tempFile
f()
os.Stdout = oldStdout
tempFile.Close()
b, _ := ioutil.ReadFile(tempFile.Name())
return string(b)
}
View Dockerfile
#golang
RUN apt-get update
RUN apt-get install -y --force-yes curl && \
curl -O https://go.googlecode.com/files/go1.2.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.2.linux-amd64.tar.gz && \
rm go1.2.linux-amd64.tar.gz
ENV GOPATH /gopath
ENV PATH $PATH:$GOPATH/bin:/usr/local/go/bin
You can’t perform that action at this time.