This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find command:http://www.oreillynet.com/linux/cmd/cmd.csp?path=f/find | |
find . -maxdepth 1/2/..../n | |
%to just find them and printout: | |
find . -maxdepth 1 -name '[!.]*' -size 0 -printf 'Name: %16f Size: %6s\n' | |
%delete them, may be modified to use | |
find . -maxdepth 1 -name '[!.]*' -size 0 -printf 'Name: %16f Size: %6s\n' | xargs rm | |
http://content.hccfl.edu/pollock/unix/findcmd.htm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
if __name__ == '__main__' and len(sys.argv) > 5 and sys.argv[1][-3:].upper() == 'PDF': | |
original = sys.argv[1] | |
target = original[:-4] + '.cropped.pdf' | |
left = int(sys.argv[2]) | |
top = int(sys.argv[3]) | |
right = int(sys.argv[4]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: UTF-8 -*- | |
# !/usr/bin/python | |
# read content from the html file | |
file = open('/Users/marco/PycharmProjects/StyleReplace/wechat.html' ,'r') | |
str = file.read() | |
# replace head 2 label | |
h2Start = '''<p style="line-height: 25.6px; max-width: 100%; min-height: 1em; white-space: pre-wrap; color: rgb(62, 62, 62); background-color: rgb(255, 255, 255); box-sizing: border-box !important; word-wrap: break-word !important;"><strong style="max-width: 100%; color: rgb(41, 148, 128); line-height: 25.6px; box-sizing: border-box !important; word-wrap: break-word !important;"></strong></p> | |
<p style="max-width: 100%; box-sizing: border-box !important; word-wrap: break-word !important;"><strong style="max-width: 100%; color: rgb(41, 148, 128); line-height: 25.6px; box-sizing: border-box !important; word-wrap: break-word !important;"><span style="max-width: 100%; font-size: 24px; box-sizing: border-box !important; word-wrap: break-word !important;"> '''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from collections import namedtuple | |
disk_ntuple = namedtuple('partition', 'device mountpoint fstype') | |
usage_ntuple = namedtuple('usage', 'total used free percent') | |
def disk_partitions(all=False): | |
"""Return all mountd partitions as a nameduple. | |
If all == False return phyisical partitions only. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum groupinstall 'Development tools' -y | |
yum install ncurses ncurses-devel wget git -y | |
cd /usr/local/src | |
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2 | |
tar -xjf vim-7.4.tar.bz2 | |
cd vim74 | |
./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp | |
make && make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#originated from http://stackoverflow.com/questions/5457286/drop-multiple-databases | |
#firstly you should use mysql_config_editor to set up a "login path" which the mysql command line client can then use. | |
#http://architects.dzone.com/articles/passwordless-command-line | |
DB_STARTS_WITH="test_" | |
MYSQL="mysql" | |
DBS="$($MYSQL --login-path=restore -Bse 'show databases')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo { | |
function myFoo() { | |
return $this->myBar(); | |
} | |
function myBar() { | |
return "Foo"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo { | |
function myFoo() { | |
return $this->myBar(); | |
} | |
function myBar() { | |
return "Foo"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* The lesson from this example is in the output | |
* rather than the PHP code itself. | |
*/ | |
$magnitude_lower = pow(2, (PHP_INT_SIZE * 8) - 2); | |
p($magnitude_lower - 1); | |
p($magnitude_lower, 'See the rollover? Watch it next time around...'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding:utf-8 -*- | |
""" | |
textdiff.py | |
Original is (C) Ian Bicking <ianb@colorstudy.com> | |
With changes from Richard Cyganiak <richard@cyganiak.de> and Richard Cyganiak <richard@cyganiak.de> | |
Modified from https://github.com/cygri/htmldiff/blob/master/htmldiff | |
Finds the differences between two pieces of TEXT. |
NewerOlder