Skip to content

Instantly share code, notes, and snippets.

@graphaelli
graphaelli / ganglia_mysql.py
Created Feb 21, 2012
Ganglia For MySQL Metrics
View ganglia_mysql.py
"""
The MIT License
Copyright (c) 2008 Gilad Raphaelli <gilad@raphaelli.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@graphaelli
graphaelli / mdpreview.py
Created Feb 6, 2013
markdown previewer
View mdpreview.py
#!/usr/bin/env python
""" .vimrc: autocmd BufEnter *.md exe 'noremap <F5> :!mdpreview.py %<CR>' """
import subprocess, sys, tempfile
with tempfile.NamedTemporaryFile(suffix=".html", delete=False) as mdhtml:
subprocess.check_call(["pandoc", "--to=html", "--from=markdown", "-o", mdhtml.name, sys.argv[1]])
# webbrowser.open_new_tab ... chrome howto?
subprocess.check_call(["open", "-a", "Google Chrome", mdhtml.name])
View simplehttpserver.go
package main
import (
"flag"
"fmt"
"log"
"net/http"
)
func main() {
View pre-commit.py
#!/usr/bin/env python
import json
import subprocess
import sys
def against():
try:
subprocess.check_call("git rev-parse --verify HEAD".split())
View bucket_policy.py
#!/usr/bin/env python
from awacs.aws import Action, Condition, Policy, Principal, Statement
from awacs.aws import Deny, Everybody, StringNotEquals
from awacs.s3 import ARN as S3_ARN
import troposphere
import troposphere.s3
def resource_namify(resource_name):
View docker_registry_consumer_policy.py
import troposphere
import troposphere.ec2
import troposphere.iam
from awacs.aws import Allow, Statement, Policy
from awacs.s3 import ARN as S3_ARN
import awacs.s3 as s3
def read_only_bucket_access(bucket_name):
@graphaelli
graphaelli / Dockerfile
Last active Oct 5, 2020
Caffe with Python3 on Centos 7
View Dockerfile
FROM centos:7
MAINTAINER graphaelli "http://g.raphaelli.com/2016/01/04/centos-python3-caffe.html"
RUN yum -y update && yum clean all
# python3 deps
RUN yum -y groupinstall 'Development Tools'
RUN yum -y install bzip2-devel db4-devel gdbm-devel libpcap-devel ncurses-devel openssl-devel readline-devel sqlite-devel xz-devel zlib-devel
# jupyter deps
RUN yum -y install epel-release
RUN yum -y install blas-devel freetype-devel gcc gcc-c++ gcc-fortran git hdf5-devel lapack-devel libjpeg-turbo-devel libpng-devel make opencv-devel patch readline-devel zeromq-devel
View dsn2pgpass.py
#!/usr/bin/env python
import fileinput
import urllib.parse
urllib.parse.uses_netloc.append("postgres")
dsn = next(fileinput.input()).strip()
url = urllib.parse.urlparse(dsn)
@graphaelli
graphaelli / gist:dd75bc730a7eafd25fe99c2d6a17ed5f
Created Apr 11, 2016 — forked from debasishg/gist:8172796
A collection of links for streaming algorithms and data structures
View gist:dd75bc730a7eafd25fe99c2d6a17ed5f
  1. General Background and Overview
@graphaelli
graphaelli / scp.terminal
Last active Nov 25, 2017
Mac OSX Terminal Settings
View scp.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlueColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjE0OTAxOTYwNzggMC40OTQxMTc2NDcxIDAuOTEzNzI1NDkwMgAQAYAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp