Skip to content

Instantly share code, notes, and snippets.

View kennethreitz's full-sized avatar
🐍

Kenneth Reitz kennethreitz

🐍
View GitHub Profile
@denji
denji / nfs-tuning.md
Last active September 11, 2021 12:20
NFS Attribute Caching Performance Impact on Web Applications

A couple of days ago, I had some issues with NFS consistency, not every servers were up to date. Some servers had the good version of the file some hadn’t. However performing a ls -l seemed to fixed tempory the problem after each update (where a simple ls didn’t). Indeed issuing ls with the -l option triggers stat() where ls doesn’t, just because file attributes are called from the stats() function. I needed to investigate…

I. Story

We determined that some web virtual didn’t delivered the same content, some page weren’t updated properly. We quickly figured out that the issue was located of the NFS attribute caching, by default too long, at least in our setup. The first change we made was to enable the noac option on the client mount. However while trying to enhance the consistency of the NFS data, the performance impact was pretty high. The impact was easy to detect and reproduce. Basically everytime a page was request from the webser, the client had to request the NFS server to be sure to del

@evanscottgray
evanscottgray / docker_kill.sh
Last active November 7, 2023 03:40
kill all docker containers at once...
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.txt

These numbers are based on the downloads from PyPI from 2014-01-02 through 2014-01-15. It only includes people using pip 1.4 or greater as no other installer provides the kind of granularity in it's user agent to process these numbers.

Downloads by Python Language Major Version

SELECT array_to_string(python_version[0:1], '.') AS python_version, COUNT(*)
FROM (
    SELECT string_to_array(python_version, '.') AS python_version
    FROM downloads
    WHERE installer_type = 'pip' AND installer_version != ''
) AS d
@wolever
wolever / ShazChains.ipynb
Created November 12, 2013 21:56
ShazChains: very, very naive markov chains from @shazow's tweets
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@holman
holman / Guthrie IP.md
Last active August 4, 2016 03:30
Woody Guthrie, on intellectual property.

This song is Copyrighted in U.S., under Seal of Copyright # 154085, for a period of 28 years, and anybody caught singin it without our permission, will be mighty good friends of ourn, cause we don’t give a dern. Publish it. Write it. Sing it. Swing to it. Yodel it. We wrote it, that’s all we wanted to do.

  • Woody Guthrie, 1940's —
@kennethreitz
kennethreitz / positivepython.md
Last active July 28, 2016 16:58
Stay positive.

#positivepython

The legendary #django-social channel was once a lovely place of vibrant, cheerful discussion. I miss that.

This experimental channel is a place for off-topic, positive conversation. IRC is a great place to bitch and vent, but #positivepython is not the place for it.

Logs are available at botbot.me. Feel free to invite anyone that you feel should be a part of the group. We want to be selective, not exclusive.

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@idan
idan / impostor.md
Created May 26, 2013 20:29
Hybrid Impostor Syndrome

I'm a hybrid designer/developer, but I socialize with more developers than designers—at conferences, online, etc. I have a very specific form of impostor syndrome. I think it might be instructive when examining impostor syndrome, in the same way that optical illusions can be instructive when examining the workings of perception.

I am not a rockstar designer. Or, for that matter, developer. Or anything, really. I am talented, and I feel that I could be a badass at something. Looking around me at tech conferences and our erstwhile online communities, I think this is a feeling that a lot of us share. We're all looking for that outlet, that thing that we would be a game-changer at doing. In our heads, we fantasize about being some kind of Michael Jordan of X, or maybe something with less glamor. A savant-like rain-man at content marketing, or scalable API design, or documentation, or low-latency concurrent network development, or whatever it is that we think we like doing. The point is that this isn't some humb

@mangecoeur
mangecoeur / a-conda-workon-tool.md
Last active February 9, 2021 14:53
A "virtualenv activate" for Anaconda environments

A "virtualenv activate" for Anaconda environments

I've been using the Anaconda python package from continuum.io recently and found it to be a good way to get all the complex compiled libs you need for a scientific python environment. Even better, their conda tool lets you create environments much like virtualenv, but without having to re-compile stuff like numpy, which gets old very very quickly with virtualenv and can be a nightmare to get correctly set up on OSX.

The only thing missing was an easy way to switch environments - their docs suggest running python executables from the install folder, which I find a bit of a pain. Coincidentally I came across this article - Virtualenv's bin/activate is Doing It Wrong - which desribes a simple way to launch a sub-shell with certain environment variables set. Now simple was the key word for me since my bash-fu isn't very strong, but I managed to come up with the script below. Put this in a text file called conda-work

@yoavram
yoavram / build_pandoc_for_heroku.sh
Last active April 29, 2017 16:28
How to build pandoc for heroku. This was run on an Ubuntu 12.04 machine with root permission. Regular lines are commands, lines starting with '>' represent the output of a command.
sudo apt-get install vagrant
git clone https://bitbucket.org/puffnfresh/vagrant-haskell-heroku.git
cd vagrant-haskell-heroku
vagrant up
vagrant ssh
cabal update
cabal install cabal-install
cabal --version
> cabal-install version 0.14.0
> using version 1.14.0 of the Cabal library