Skip to content

Instantly share code, notes, and snippets.

🍪
Focusing

Ben Mezger (seds) benmezger

🍪
Focusing
Block or report user

Report or block benmezger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benmezger
benmezger / mac-curl-ca-bundle.sh
Created Dec 11, 2015 — forked from 1stvamp/mac-curl-ca-bundle.sh
Script to install cURL CA certificates on OS X without macports
View mac-curl-ca-bundle.sh
#!/bin/bash
mkdir /tmp/curl-ca-bundle
cd /tmp/curl-ca-bundle
wget http://curl.haxx.se/download/curl-7.22.0.tar.bz2
tar xzf curl-7.22.0.tar.bz2
cd curl-7.22.0/lib/
./mk-ca-bundle.pl
if [ ! -d /usr/share/curl/ ]; then
sudo mkdir -p /usr/share/curl/
else
View gist:5081940
# Randoms.py:
import random
import hahaha
import hihihi
print "Hello, this is the end of the file"
# check_module.py
In [1]: from modulefinder import ModuleFinder
@benmezger
benmezger / gist:5130523
Created Mar 10, 2013
Perhaps a robotparser module bug?
View gist:5130523
In [65]: rp.set_url("https://www.facebook.com/robots.txt")
In [66]: rp.can_fetch("Hello_crawler", "http://www.facebook.com")
Out[66]: True
In [67]: rp.can_fetch("Hello_crawler", "http://www.facebook.com/sharer/")
Out[67]: True
@benmezger
benmezger / gist:5135315
Created Mar 11, 2013
robotparser failing?
View gist:5135315
In [2]: import robotparser
In [3]: x = robotparser.
robotparser.Entry robotparser.RuleLine robotparser.urllib
robotparser.RobotFileParser robotparser.URLopener robotparser.urlparse
In [3]: x = robotparser.RobotFileParser()
In [4]: x.set_url("http://www.google.com/robots.txt")
@benmezger
benmezger / README.md
Created Dec 30, 2015 — forked from StefanWallin/README.md
nginx ssl config with multiple SNI vhosts and A+ SSL Labs score as of 2014-11-05
View README.md

Configuring nginx for SSL SNI vhosts

Gotchas

Remarks

  • My version of konklones SSL config does not have SPDY support(my nginx+openssl does not support it)
  • You need a default ssl server (example.org-default.conf).
  • Some SSL-options have to be unique across your instance, so it's easier to have them in a common file(ssl.conf).
@benmezger
benmezger / nginx.conf
Created Feb 12, 2016 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@benmezger
benmezger / site.conf
Created Feb 12, 2016 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
View site.conf
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@benmezger
benmezger / README.rst
Created Mar 16, 2016 — forked from dupuy/README.rst
Common markup for Markdown and reStructuredText
View README.rst

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

@benmezger
benmezger / index.html
Created Mar 24, 2016
Dynamic URL using javascript (for subdomains with different tld)
View index.html
<pre id="bar"><a id="blog">BLOG</a> XOR <a id="about" title="">ABOUT</a> XOR <a id="code">CODE</a> XOR <a id="photos" title="">PHOTOS</a></pre></td></tr>
<script>
function makeUrl(_id){
var protocol = window.location.protocol;
var url = window.location.host.replace("www.", "");
var new_url = protocol + "//" + _id + "." + url;
document.getElementById(_id).setAttribute("href", new_url);
}
makeUrl("blog");
@benmezger
benmezger / comprehensions.md
Created Mar 27, 2016 — forked from bearfrieze/comprehensions.md
Comprehensions in Python the Jedi way
View comprehensions.md

Comprehensions in Python the Jedi way

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

All of the tasks presented in the examples can be accomplished with the extensive standard library available in Python. These solutions would arguably be more terse and efficient in some cases. I don't have anything against the standard library. To me there is a certain

You can’t perform that action at this time.