Skip to content

Instantly share code, notes, and snippets.

View shady-robot's full-sized avatar
👋

Shady shady-robot

👋
  • Inrovo
  • Guangzhou, China
View GitHub Profile
@shady-robot
shady-robot / iterm2-solarized.md
Created December 24, 2019 09:53 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

在发送一个REST API请求时,根据应用的场景,针对相同的资源,可能会期待不同的返回形式。
Rest API应具备完整的内容协商能力
通过在header里面设置 Accept:告诉WEB服务器自己接收的内容类型,内容类型中的先后次序表示客户端接收的先后次序。 */* 表示任何类型,type/* 表示该text/html,application/json
请求不支持的格式:415 Unsupported Media Type
--->
(1). 返回内容格式指定
http://gym.api.ruizhutech.com/activities/251/entrances/?format=json
(2). 通过在header里面指定
http://gym.api.ruizhutech.com/activities/251/entrances/
@shady-robot
shady-robot / Django common settings
Last active May 12, 2016 04:05
Settings in django
How to install mysql-client to connect django and MySQL:
(1). Make sure the MySQL is installed
(2). Use the following command to install the package:
Ubuntu:
$sudo apt-get install libmysqlclient-dev
CentOS:
$ sudo apt-get install mysql-devel
(3). inside the virtualenv
Tmux is a "terminal multiplexer", it enables a number of terminals to be accessed and controlled from a single terminal.
If you use Debian/Ubuntu, you can just run apt-get install tmux, and voila.
Since the title was about centos 7, then do the following step to install tmux.
(1). tmux has a library dependency on libevent which, of course, isn’t installed by default.
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xzvf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure && make
@shady-robot
shady-robot / SQL syntax
Created July 20, 2015 08:07
SQL statement for privileges management in MySQL
####This is a cheat sheet for mysql syntax, which is mostly about privilege management in mysql.
---------------------------------------------------------------------------------------------------------------------
### List all the user in mysql(with access to the mysql database)
mysql> select user, host, password from mysql.user;
### Create a user with password
mysql> create user 'shady'@'localhost' identified by 'password';
### Create a user without password
mysql> create user 'eric'@'localhost';
-----------------------------------------------------------------------------------------------------------------------
@shady-robot
shady-robot / DateTime
Last active December 29, 2018 11:32
A reference for datetime format
Mostly about the java.time package, about time and date format issue.
Nothing Special, just for reference.
@shady-robot
shady-robot / .gitignore
Last active August 29, 2015 14:24 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #