Skip to content

Instantly share code, notes, and snippets.

easyblock = "MakeCp"
name = "vcflib"
version = "0.1-20150507"
homepage = "https://github.com/ekg/vcflib"
description = "a simple C++ library for parsing and manipulating VCF files, + many command-line utilities"
# You will need to git clone --recursive https://github.com/ekg/vcflib.git
# and then create an archive from that
sources = ['%(name)s-%(version)s.tar.gz']
@serverhorror
serverhorror / new-installation.R
Created August 20, 2014 17:16
R Upgrade of Packages between versions
# Install bioConductor in your new R installation
source("http://bioconductor.org/biocLite.R")
chooseBioCmirror()
biocLite()
# install missing R packages for bioConductor
load("installed_old.rda")
tmp <- installed.packages()
installedpkgs.new <- as.vector(tmp[is.na(tmp[,"Priority"]), 1])
missing <- setdiff(installedpkgs, installedpkgs.new)
class userpackages (packages) {
# magic to get a list of packages that users want
# maybe fill the foreman API with simple inputs from a web page
# the verification would be wether the package is available in configured repositories...
package { $packages:
ensure => latest,
}
}
@serverhorror
serverhorror / gist:b6f6e464846d05003699
Last active March 2, 2022 17:32
PostgreSQL 8.4 COPY Comand
COPY (
SELECT
datname,
pg_database_size(datname),
pg_size_pretty(pg_database_size(datname))
FROM
pg_catalog.pg_database
WHERE
datistemplate=false and
datallowconn=true and
@serverhorror
serverhorror / main.go
Created June 2, 2014 17:21
(Some) Linux HW Info with golang
package main
import (
"encoding/json"
"fmt"
"log"
"net"
)
func main() {

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"code.google.com/p/go.crypto/openpgp/armor"
"fmt"
"io/ioutil"
"log"
)
@serverhorror
serverhorror / mdserv
Created April 11, 2014 18:47 — forked from smoser/mdserv
#!/usr/bin/python
"""
To use this to mimic the EC2 metadata service entirely, run it like:
# where 'eth0' is *some* interface. if i used 'lo:0' i got 5 second or so delays on response.
sudo ifconfig eth0:0 169.254.169.254 netmask 255.255.255.255
sudo ./mdserv 169.254.169.254:80
Then:
wget -q http://169.254.169.254/latest/meta-data/instance-id -O -; echo
curl --silent http://169.254.169.254/latest/meta-data/instance-id ; echo
def test(n):
if n%3==0: return True
if n%5==0: return True
return False
sum(filter(test, range(1000)))
def fib(max):
a, b = 1, 2
while a<max:
yield a
a, b = b, a + b
def even(n):
if n%2==0: return True
return False
sum(filter(even, fib(4000000)))