通过修改 /etc/apt/sources.list 来把链接指向旧的版本仓库
以下实例代码将/etc/apt/sources.list中的所有 archive.ubuntu.com 和 security.ubuntu.com替换成 old-releases.ubuntu.com
sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
再看看有没有 /etc/apt/sources.list.d/ 这个文件,可以把这个文件一起修改
grep -E 'archive.ubuntu.com|security.ubuntu.com' /etc/apt/sources.list.d/*
sudo apt-get update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ | |
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz | |
tar xvzf libevent-2.1.8-stable.tar.gz | |
cd libevent-2.1.8-stable | |
./configure --prefix=$HOME/bin --disable-shared | |
make | |
make install | |
cd ~ | |
wget https://invisible-mirror.net/archives/ncurses/ncurses-6.1.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -l | |
# download gcc source code | |
cd $HOME | |
wget http://mirrors.concertpass.com/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.gz | |
tar -xzf gcc-8.2.0.tar.gz | |
cd gcc-8.2.0/ | |
./contrib/download_prerequisites | |
# config makefile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_task_time1(tasks): | |
# use a dict, keep all task last run time | |
# more space used, less run time expected | |
time = 0 | |
d = dict() | |
for t in tasks: | |
if t in d: | |
last = d[t] | |
time = max(last + n, time) + 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calc_distance(lat1, lng1, lat2, lng2): | |
""" 城市内距离计算函数,这里是简化了 Haversine 公式,单位是米 | |
在一个城市的范围内,可以近似认为经线和纬线是垂直的 | |
""" | |
dx = lng1 - lng2 # 经度差值 | |
dy = lat1 - lat2 # 纬度差值 | |
b = (lat1 + lat2) / 2.0 # 平均纬度 | |
lx = math.radians(dx) * 6367000.0 * math.cos(math.radians(b)) # 东西距离 | |
ly = 6367000.0 * math.radians(dy) # 南北距离 | |
return math.sqrt(lx * lx + ly * ly) # 用平面的矩形对角距离公式计算总距离 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
class People: | |
def __init__(self, name): | |
self.name = name | |
class Transaction: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `healthcare_center_employees` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`name` varchar(100) NOT NULL, | |
`ssnNumber` char(20) NOT NULL, | |
`address` varchar(200) NOT NULL, | |
`phone` char(20) NOT NULL, | |
`email` varchar(200) NOT NULL, | |
`pastAndCurrentJobTitle` varchar(100) NOT NULL, | |
`salary` double(16, 4) NOT NULL, | |
`benefits` text NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import requests | |
import re | |
import hashlib | |
import simplejson | |
from bs4 import BeautifulSoup | |
requests.adapters.DEFAULT_RETRIES = 10 | |
session = requests.session() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```python | |
from ec.broker.user_persona import update_user_persona | |
from mysite.model.user import User | |
from mysite.model.const.user import STATE_ACTIVE | |
from mysite.util.orm import ormiter | |
from progress.bar import Bar | |
if __name__ == '__main__': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```sql | |
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; | |
FLUSH PRIVILEGES; | |
GRANT ALL PRIVILEGES ON DB_NAME.* TO user_name@'%'; | |
``` |
NewerOlder