A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
def authenticated(auth): | |
def decore(f): | |
def _request_auth(handler): | |
handler.set_header('WWW-Authenticate', 'Basic realm=tmr') | |
handler.set_status(401) | |
handler.finish() | |
return False | |
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# archive.py | |
# | |
# Copyright 2011 Matthew Brush <[email protected]> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or |
var fs = require('fs'); | |
var confess = { | |
run: function () { | |
var cliConfig = {}; | |
confess.performancecache = this.clone(confess.performance); | |
if (!this.processArgs(cliConfig, [ | |
{ | |
name: 'url', | |
def: 'http://google.com', |
// phantomjs --web-security=no most_used_css_property_names.js | |
var urls = [ | |
'http://google.com', | |
'http://facebook.com', | |
'http://youtube.com', | |
'http://yahoo.com', | |
'https://github.com/', | |
'http://twitter.com/', | |
'http://en.wikipedia.org/wiki/Main_Page', |
TL;DR - jump to the challenge at the end | |
====ON BLOCKING EVIL BOTS===== | |
On a resent job interview I had for "Incapsula" a few days ago I was put to the challenge to break | |
their bot protection mechanism. Apparently node.js is not that common among bot writes and most bots | |
are not able to run javascript. | |
The challenge had two parts - | |
1. find what the code does. | |
2. implement a bot that will break the code without using js. | |
3. think how to make this code unbreakable |
FILE SPACING: | |
# double space a file | |
sed G | |
# double space a file which already has blank lines in it. Output file | |
# should contain no more than one blank line between lines of text. | |
sed '/^$/d;G' |
# Sane settings for Gnome | |
gsettings set org.gnome.desktop.background show-desktop-icons true | |
gsettings set org.gnome.desktop.interface clock-show-date true | |
gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing 'grayscale' | |
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting 'slight' | |
gsettings set org.gnome.desktop.interface text-scaling-factor '1.0' | |
gsettings set org.gnome.desktop.interface monospace-font-name "Monospace 10" | |
gsettings set org.gnome.desktop.interface document-font-name 'Sans 10' | |
gsettings set org.gnome.desktop.interface font-name 'Cantarell 10' | |
gsettings set org.gnome.desktop.interface gtk-theme 'Adwaita' |
import ( | |
"crypto/md5" | |
"encoding/hex" | |
) | |
func GetMD5Hash(text string) string { | |
hasher := md5.New() | |
hasher.Write([]byte(text)) | |
return hex.EncodeToString(hasher.Sum(nil)) | |
} |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
http { | |
log_format bodylog '$remote_addr - $remote_user [$time_local] ' | |
'"$request" $status $body_bytes_sent ' | |
'"$http_referer" "$http_user_agent" $request_time ' | |
'<"$request_body" >"$resp_body"'; | |
lua_need_request_body on; | |
set $resp_body ""; | |
body_filter_by_lua ' |