Skip to content

Instantly share code, notes, and snippets.

🐟
摸鱼中

PRIN.T printempw

🐟
摸鱼中
Block or report user

Report or block printempw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@printempw
printempw / gist:0e900c2e2fdd034aac5c
Created Aug 12, 2015
shadowsocks one-key install shell
View gist:0e900c2e2fdd034aac5c
#! /bin/bash
#==================================
# AUTHOR: printempw
# NOTE: I HAVEN'T WRITE ANY DEBUG CODE IN THIS SHELL,
# IF ANY ERROR RAISES,UMM,JUST LET IT GO
# SYSTEM REQUIRED: ONLY FOR UBUNTU
#==================================
clear
echo ""
@printempw
printempw / hitokoto.py
Created Dec 27, 2015
Python 一言爬虫
View hitokoto.py
#!/usr/bin/env python
# -*- coding=utf-8 -*-
import sys
# Python version check
if (sys.version_info[0] < 3):
print("This script only works on Python 3+.")
exit(1)
import os, time
import urllib.request
View gist:689a1da4b515aa682d4b
#!/usr/bin/env python
# -*- coding=utf-8 -*-
art_dict = {}
def getArtLines(ascii):
lineNumberStart = (ascii - 64 - 1)*3 + 1
result = []
lines = ['┌─┐', '├─┤', '┴ ┴', '┬┐ ', '├┴┐', '┴─┘', '┌─┐', '', '└─┘', '┬─┐', '│ │', '┴─┘', '┌─┐', '├┤ ', '└─┘', '┬─┐', '├┤ ', '', '┌─┐', '│ ┐', '└─┘', '┬ ┬', '├─┤', '┴ ┴', '', '', '', '', '', '└┘ ', '┐┌ ', '├┴┐', '┴ ┴', '', '', '┴─┘', '┌┬┐', '│││', '┴ ┴', '┌┐┌', '│││', '┘└┘', '┌─┐', '│ │', '└─┘', '┬─┐', '├─┘', '', '┌─┐', '│ │', '└─┴', '┬─┐', '├┬┘', '┴└─', '┌─┐', '└─┐', '└─┘', '┌┬┐', '', '', '┐ ┌', '│ │', '└─┘', '┐ ┌', '└┐│', ' └┘', '┬ ┬', '│││', '└┴┘', '┬ ┬', '└┬┘', '┴ ┴', '┬ ┬', '└─┤', '└─┘', '┌─┐', '┌─┘', '└─┘']
for i in range(3):
View like.php
<?php
/* MySQL 数据库名称 */
define('DB_NAME', 'wordpress');
/* MySQL 数据库用户名 */
define('DB_USER', 'root');
/* MySQL 数据库密码 */
define('DB_PASSWD', 'root');
@printempw
printempw / autoload.js
Last active Aug 5, 2016
Add page view counter for Ghost blog
View autoload.js
/**
* Add to $(document).ready()
* Will auto load page view for each post on the page
*/
$('[id=post-view]').each(function(){
url = 'http://127.0.0.1/count.php?action=get&slug='+$(this).attr('data').slice(1,-1);
var span = $(this);
$.getJSON(url, function(data) {
span.html(data.count);
});
@printempw
printempw / convert.php
Last active Feb 1, 2016
Convert data of WP-PostViews to fit custom page counter of Ghost
View convert.php
<?php
/**
* @Author: printempw
* @Date: 2016-02-01 20:37:43
* @Last Modified by: prpr
* @Last Modified time: 2016-02-01 22:10:06
*
* Configure your database connection info here.
* $wp_conn for WordPress installation database,
* $ghost_conn for which you place `post_views` table in.
@printempw
printempw / count_universal.php
Last active Sep 15, 2018
Ghost page view counter, support both MySQL and SQLite.
View count_universal.php
<?php
/**
* @Author: printempw
* @Date: 2016-01-31 17:08:29
* @Last Modified by: prpr
* @Last Modified time: 2016-02-02 16:31:55
*
* Database type, `mysql` or `sqlite`
*/
define('DB_TYPE', 'mysql');
@printempw
printempw / autoloader.php
Last active Mar 18, 2016
Autoload PHP namespace
View autoloader.php
<?php
function __autoload($classname) {
$dir = dirname(__FILE__);
$include_dir = $dir.DIRECTORY_SEPARATOR."includes".DIRECTORY_SEPARATOR."classes".DIRECTORY_SEPARATOR;
$filename = $include_dir.str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.class.php';
require_once($filename);
}
@printempw
printempw / robbyrussell-makaizou-local.zsh-theme
Last active Apr 20, 2018
Modified Zsh theme, Robby Russell Makaizou. Added user@hostname prompt which is convenient for VPS management.
View robbyrussell-makaizou-local.zsh-theme
# For local shell, prompt is lik this
# ➜ blessing-skin-server git:(master)$
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}%{$reset_color%}%{$fg_bold[blue]%}$ %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗ %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@printempw
printempw / click-game.css
Last active Nov 3, 2016
Click the element to show a "+1" animation and change the content of the element to a new kaomoji. Just for fun :)
View click-game.css
#kaomoji {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.info-rise {
z-index: 99999;
position: absolute;
padding: 0 4px;
border-radius: 1px;
You can’t perform that action at this time.