Skip to content

Instantly share code, notes, and snippets.

View harryfyodor's full-sized avatar

harryfyodor harryfyodor

View GitHub Profile
@harryfyodor
harryfyodor / all_about_mongo.txt
Last active October 2, 2018 02:55
all about mongodb
# 用户
1. 先开启数据库
mongod
2. 开终端
mongo
use admin
db.createUser(
{
user: "admin1",
@harryfyodor
harryfyodor / Aliyun.txt
Last active October 17, 2018 02:44
Aliyun
# Linux 格式化和挂载数据盘
https://help.aliyun.com/document_detail/25426.html?spm=5176.8208715.110.2.72a84ae8dFMM8S
# 端口开放
需要在 安全组规则 ——> 配置规则 那里进行设置
@harryfyodor
harryfyodor / jupyter_on_server.txt
Created August 21, 2018 09:00
jupyter_on_server
1.
jupyter notebook --generate-config
2.
>>> from IPython.lib import passwd
>>> passwd()
# cp the sha code
3.
vi ~/.jupyter/jupyter_notebook_config.py
@harryfyodor
harryfyodor / your_system_is_running_in_low-graphics_mode.txt
Last active August 19, 2018 03:29
your system is running in low-graphics mode
1. cd /etc/X11
2. sudo mv xorg.conf.safemode xorg.conf
3. reboot
4. 重装驱动
估计是驱动版本和电脑本身的冲突, 重启偶见这种情况
import torch
from collections import OrderedDict
# 加载一个用多GPU训练的模型
state = torch.load(modelName)['state_dict']
cpu_model_dict = OrderedDict()
# 生成一个新的dict
for k, v in state.items():
name = k[7:] # remove `module.`
#!/bin/bash
echo "请您输入你想删除的文件个数(时间越早的文件靠前):"
read file_num
total_file_num=`ls -l | grep "^d" | wc -l` # 统计目录文件的个数
if (( $file_num > $total_file_num ))
then echo "您要删除的文件数目太多!"
else
ls -ltr | grep -v 'total' | grep "^d" | awk '{print $9}' | head -n $file_num | xargs rm -rf
echo "删除成功!"
@harryfyodor
harryfyodor / leetcode-array.md
Last active March 15, 2017 22:38
Leetcode刷题

(495) Teemo Attacking

这道题难度比较低,主要是通过遍历数组,通过差值来确定要减去多少个poison区域。

class Solution {
public:
    int findPoisonedDuration(vector<int>& timeSeries, int duration) {
      if(timeSeries.size() == 1) return duration;
      int l = duration * timeSeries.size();
    	if(timeSeries.size() == 1) return 2;

昨天搞定了一个小网站的搭建,用了 node.js,另外为了能在一个 VPS 上搭建多个网站,用了 nginx 作为反向代理。

软件介绍

嗯,从维基上复制了一下~

node.js

Node.js是一个事件驱动I/O伺服端JavaScript环境,基于V8。目的是为了提供撰写可扩充网络程式,如web服务。第一个版本由Ryan Dahl于2009年释出,后来,Joyent雇用了Dahl,并协助发展Node.js。