Skip to content

Instantly share code, notes, and snippets.

@shouya
Created December 16, 2014 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shouya/c2d94a4832fe05db6b72 to your computer and use it in GitHub Desktop.
Save shouya/c2d94a4832fe05db6b72 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import urllib.request
from os import system
response = urllib.request.urlopen('http://ipinfo.io/country')
country = response.read().decode('utf-8').rstrip("\n")
if country == 'CN':
system("sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment