Skip to content

Instantly share code, notes, and snippets.

View andrewwxy's full-sized avatar

Andrew andrewwxy

View GitHub Profile
Some may be more advanced than others, and some are vi only...
Vim Tutorials
=============
* http://blog.smr.co.in/linux/advanced-vim-tutorial/
* http://www.yolinux.com/TUTORIALS/LinuxTutorialAdvanced_vi.html
* http://www.derekwyatt.org/vim/vim-tutorial-videos/vim-advanced-tutorial-videos/
* http://linuxgazette.net/152/srinivasan.html
* http://www.eng.hawaii.edu/Tutor/vi.html
@nichtich
nichtich / viaflookup.pl
Created February 17, 2011 16:32
Make use of VIAF authority records
#!/usr/bin/perl
=head1 NAME
viaflookup.pl - How to make use of VIAF authority records
=head1 VERSION
Version 0.2 - 2011-02-18
@kennethreitz
kennethreitz / 0_urllib2.py
Created May 16, 2011 00:17
urllib2 vs requests
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
gh_url = 'https://api.github.com'
req = urllib2.Request(gh_url)
password_manager = urllib2.HTTPPasswordMgrWithDefaultRealm()
@andsens
andsens / bootstrap_homeshick.sh
Last active December 27, 2023 12:47
Script that can set up an entire user account with homeshick automatically
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@vsajip
vsajip / pyvenvex.py
Last active May 18, 2024 23:13
A script which demonstrates how to extend Python 3.3's EnvBuilder, by installing setuptools and pip in created venvs. This functionality is not provided as an integral part of Python 3.3 because, while setuptools and pip are very popular, they are third-party packages.The script needs Python 3.3 or later; invoke it using"python pyvenvex.py -h"fo…
#
# Copyright (C) 2013-2020 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve
@pkmishra
pkmishra / middlewares.py
Last active November 8, 2020 05:26
Scrapy middlewares for random agent list and proxy server usage.
import os
import random
from scrapy.conf import settings
class RandomUserAgentMiddleware(object):
def process_request(self, request, spider):
ua = random.choice(settings.get('USER_AGENT_LIST'))
if ua:
request.headers.setdefault('User-Agent', ua)
class ProxyMiddleware(object):
@hdemers
hdemers / pydata-science.sh
Last active June 1, 2020 07:17
Installation instructions for doing data science in a Python environment on Ubuntu. We'll install base packages like numpy, scipy, scikit-learn and pandas. We also install the IPython Notebook interactive environment. This is a best practice recommendation for doing research-type work. We make use of virtualenvwrapper, but don't show how to inst…
mkvirtualenv datascience
sudo apt-get install python-scipy libblas-dev liblapack-dev gfortran
sudo apt-get install libffi-dev # for cryptography from scrapy
sudo apt-get install libxslt-dev # for libxml from scrapy
export BLAS=/usr/lib/libblas.so
export LAPACK=/usr/lib/liblapack.so
pip install numpy
pip install scipy
pip install scikit-learn
pip install pandas
@JohnStuartRutledge
JohnStuartRutledge / python_idioms.md
Last active February 23, 2023 09:56
A gist for tracking examples of idiomatic Python. The goal is to accrue a list of concrete examples to help develop an intuition of what constitutes "Pythonic" code.