进不了ILM的屌丝男

其实就算进了你也还是个屌丝 你这个傻X – PS : 你的确是个傻X

如何从”网际网路“远程唤醒Synology NAS ( WOL over internet)

显然在本地局域网 官方的ds finder就可以,或者如果你有tomato / dd-wrt enabled的router也行(登录到webui有带这个菜单的),但是试了下如果在外面,想通过ds finder或是某些工具都不行,所以一直在用登录到tomato的webui,然后填mac地址,再按wakeup的脑残法

Read more of this post

LXDE的terminal 如何clear scrollback

菜单里居然没有,不过可以

reset

to reset your terminal when it gets messed up by control sequences.

clear

to clear the terminal window.
或者是

echo -e '\0033\0143'

on FreeBSD echo doesn’t accept -e so you can try:

printf '\033\143'

Read more of this post

pip常用命令备忘录

脑残用法合集

装到自己的 ~/.local/lib/python2.6/site-packages里,但是这个会出现在sys.path的最前面,所以可能影响公司工具

pip install --user <package>

Read more of this post

pidgin安装截图插件pidgin-sendscreenshot

脑残的用ksnapshot截,然后另存再发了好久,为什么没早点装pidgin-sendscreenshot呢…

Read more of this post

Fedora 20 接 bluetooth鼠标

Bluetoothctl

Pairing a device from the shell is one of the most simplistic and reliable options. The exact procedure depends on the devices involved and their input functionality. What follows is a general outline of pairing a device using
/usr/bin/bluetoothctl:

Read more of this post

如何用urllib urllib2 requests 下载文件(带进度条)

备份自各处:
requests

def download_file(url):
    local_filename = url.split('/')[-1]
    # NOTE the stream=True parameter
    r = requests.get(url, stream=True)
    with open(local_filename, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024): 
            if chunk: # filter out keep-alive new chunks
                f.write(chunk)
                f.flush()
    return local_filename

urllib.urlretrieve 但是这个似乎不能cookies 和 authentication

import sys
import time
import urllib
  
def reporthook(count, block_size, total_size):
    global start_time
    if count == 0:
        start_time = time.time()
        return
    duration = time.time() - start_time
    progress_size = int(count * block_size)
    speed = int(progress_size / (1024 * duration))
    percent = int(count * block_size * 100 / total_size)
    sys.stdout.write("\r...%d%%, %d MB, %d KB/s, %d seconds passed" %
                    (percent, progress_size / (1024 * 1024), speed, duration))
    sys.stdout.flush()
 
def save(url, filename):
    urllib.urlretrieve(url, filename, reporthook)

urllib2

import urllib2, sys

def chunk_report(bytes_so_far, chunk_size, total_size):
   percent = float(bytes_so_far) / total_size
   percent = round(percent*100, 2)
   sys.stdout.write("Downloaded %d of %d bytes (%0.2f%%)\r" % 
       (bytes_so_far, total_size, percent))

   if bytes_so_far >= total_size:
      sys.stdout.write('\n')

def chunk_read(response, chunk_size=8192, report_hook=None):
   total_size = response.info().getheader('Content-Length').strip()
   total_size = int(total_size)
   bytes_so_far = 0

   while 1:
      chunk = response.read(chunk_size)
      bytes_so_far += len(chunk)

      if not chunk:
         break

      if report_hook:
         report_hook(bytes_so_far, chunk_size, total_size)

   return bytes_so_far

if __name__ == '__main__':
   response = urllib2.urlopen('http://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-latest-win64-static.7z');
   chunk_read(response, report_hook=chunk_report)

Fedora 默认repo里装的ffmpeg不能下rtmp?

用的时候有错误提示

Detected librtmp style URL parameters, these aren't supported by the libavformat internal RTMP handler currently enabled. See the documentation for the correct way to pass parameters.

Read more of this post

python tips : rlcompleter & rlcompleter2 tab自动完成

突然发现tab后面自动显示所有symbol不是默认功能… 原来是公司加的啊….

Read more of this post

如何让Maya使用外部的Python interpreter

人肉备份自StackOverflow : How do I change the python version in Maya 2013?

Maya doesn’t use your installed Python but rather its own 2.6 version of python which is included with the software.

However, it’s possible to change that by setting the PYTHONHOME environment variable. The following article explains how to do that and how to check that it’s setup correctly:

Read more of this post

py2exe vs pyInstaller vs cx_Freeze 测试备忘录

Solution Windows Linux OS X Python 3 License One-file mode Zipfile import Eggs pkg_resources support
bbFreeze yes yes yes no MIT no yes yes yes
py2exe yes no no no MIT yes yes no no
pyInstaller yes yes yes no GPL yes no yes no
cx_Freeze yes yes yes yes PSF no yes yes no

Read more of this post

Follow

Get every new post delivered to your Inbox.