Skip to content

Instantly share code, notes, and snippets.

View defbobo's full-sized avatar
💭
I may be slow to respond.

Xiao Bo defbobo

💭
I may be slow to respond.
View GitHub Profile
@defbobo
defbobo / cryptography
Created October 12, 2018 01:49
Anaconda funny issue on windows10
Problem:
run import OpenSSL, meet:
11 from cryptography import utils
12 from cryptography.exceptions import InternalError
---> 13 from cryptography.hazmat.bindings._openssl import ffi, lib
14 from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES
15
ImportError: DLL load failed: The operating system cannot run %1.
@defbobo
defbobo / daemon.py
Created June 27, 2018 12:48 — forked from jamiesun/daemon.py
一个python守护进程的例子
#! /usr/bin/env python2.7
#encoding:utf-8
#@description:一个python守护进程的例子
#@tags:python,daemon
import sys
import os
import time
import atexit
from signal import SIGTERM
@defbobo
defbobo / nginx.conf
Created May 14, 2018 02:25 — forked from thoop/nginx.conf
Official prerender.io nginx.conf for nginx
# Change YOUR_TOKEN to your prerender token and uncomment that line if you want to cache urls and view crawl stats
# Change example.com (server_name) to your website url
# Change /path/to/your/root to the correct value
server {
listen 80;
server_name example.com;
root /path/to/your/root;
index index.html;

Simple cheatsheets

Including git, vagrant, pandas

Personal Linux program installation Note

  1. mysql installation
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
  1. redis installation
@defbobo
defbobo / multiple_ssh_setting.md
Created July 14, 2017 04:14 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@defbobo
defbobo / recover_source_code.md
Created July 13, 2017 08:30 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@defbobo
defbobo / CentOS Python3.5
Last active June 8, 2020 06:58
Installation
yum groupinstall 'Development Tools'
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tar.xz
tar Jxvf Python-3.5.0.tar.xz
cd Python-3.5.0
./configure --prefix=/usr/local/python3
make && make install
echo 'export PATH=$PATH:/usr/local/python3/bin' >> ~/.bashrc
rm /usr/bin/python
ln -sv /usr/local/bin/python3.5 /usr/bin/python