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 / bash.zsh-theme
Last active Nov 21, 2019
My custom oh-my-zsh themes.
View bash.zsh-theme
# Just a copy of the default prompt of bash.
# root@youtube-relay-station:/home/wwwroot$
PROMPT='%{$fg[green]%}%n@%m%{$reset_color%}:%{$fg[cyan]%}%~%{$reset_color%}$ '
@printempw
printempw / concat.sh
Last active Oct 1, 2019
使用 ffmpeg 拼接 Bilibili 客户端所下载的分段 flv 视频,https://blessing.studio/use-ffmpeg-to-concat-flv-videos-downloaded-by-bilibili-client/
View concat.sh
# @Author: printempw
# @Date: 2017-05-13 17:54:48
# @Last Modified by: printempw
# @Last Modified time: 2017-05-13 21:37:41
cat /dev/null > ff.txt
# 防止变成 1、10、2、3 这样的顺序
for i in `ls -1 *.flv | sort -n`; do
echo "file '${i}'" >> ff.txt;
@printempw
printempw / check_youtube.py
Created Jul 4, 2019
Check whether YouTube channel is live streaming.
View check_youtube.py
#!/usr/bin/env python3
# coding: utf-8
import re
import sys
import json
import requests
from retrying import retry
headers = {
@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
@printempw
printempw / download.php
Created Nov 26, 2016
PHP Remote Download with Progress Bar [Backend]
View download.php
<?php
// 当前文件:download.php
$action = @$_GET['action'];
// 自己获取这些信息
$remote_url = get_remote_file_url();
$file_size = get_remote_file_size($remote_url);
$tmp_path = get_tmp_path();
@printempw
printempw / index.html
Created Nov 26, 2016
PHP Remote Download with Progress Bar [Frontend]
View index.html
<p>更新包大小:<span id="file-size">0</span> Bytes</p>
<!-- 进度条 -->
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
<span id="imported-progress">0</span>%
</div>
</div>
<script>
// 更新进度条的函数
@printempw
printempw / .travis.yml
Last active Nov 8, 2018
Travis CI config for Hexo blog automatic deployment.
View .travis.yml
language: node_js
node_js: stable
# 只监听 source 分支的改动
branches:
only:
- source
# 缓存依赖,节省持续集成时间
cache:
@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 / 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]%})"
View dynamically-load-gist.js
$('.load-gist').on('click', function() {
var gist = {
// URL 传参自己改下
url: '//gist.github.com/printempw/' + $(this).data('hash') + '.json?callback=?',
dom: this
}
// 因为 URL 中带了 `callback=?`,所以这里 jQuery 会使用 JSONP 方式请求
$.getJSON(gist.url, function(data) {
// 加载样式
You can’t perform that action at this time.