This file contains hidden or 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
# k: Kilobyte, M: Megabyte, G: Gigabyte | |
# +: Bigger than, -: Lower than | |
find . -maxdepth 1 -type f -size +500k -exec rm -f {} \; | |
# Or better: | |
find . -maxdepth 1 -type f -size +50M -delete | |
# Let's have a look first: | |
find . -maxdepth 1 -type f -size +2G -exec ls -lhS {} \; | awk {print $5 "\t" $9} |
This file contains hidden or 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
# Sorts the file by duplicate line count | |
sort /path/to/filename | uniq -c | sort -nr > ./_aggregated.tmp | |
# Just read the head as it's probably a huge file | |
head -n 1000 ./_aggregated.tmp | less |
This file contains hidden or 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 documents with sub-document query: | |
// | |
db.collection_name.find({ | |
relays: { | |
$elemMatch: { | |
timestamp: {$gte: 1447628400}, | |
status: "RELAY_STATUS_ERROR_SUBMIT", | |
app_id: ObjectId("537cb1b5fc20a0eb47000000") | |
} |
This file contains hidden or 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 | |
# Print information about a single option or command | |
# http://svn.mikelward.com/svn/scripts/desc | |
# Example Usage: | |
# opt bash continue | |
# opt rsync -v | |
scriptname=desc |
This file contains hidden or 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/python | |
import glob | |
import csv | |
import sys | |
import os | |
# Check args | |
if len(sys.argv) < 2: | |
sys.exit('Usage: tsv2csv.py /path/to/dir') |
This file contains hidden or 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
( ) /\ _ ( | |
\ | ( \ ( \.( ) _____ | |
\ \ \ ` ` ) \ ( ___ / _ \ | |
(_` \+ . x ( .\ \/ \____-----------/ (o) \_ | |
- .- \+ ; ( O \____ | |
(__ +- .( -'.- <. \_____________ ` \ / | |
(_____ ._._: <_ - <- _- _ VVVVVVV VV V\ \/ | |
. /./.+- . .- / +-- - . (--_AAAAAAA__A_/ | | |
(__ ' /x / x _/ ( \______________//_ \_______ | |
, x / ( ' . / . / \___' \ / |
This file contains hidden or 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/perl | |
# | |
# @file | |
# Converter tool, from Apache Common Log file to CSV. | |
# | |
# All code is released under the GNU General Public License. | |
# See COPYRIGHT.txt and LICENSE.txt. | |
# | |
This file contains hidden or 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 . -type f -name "__MACOSX" -exec rm -rf {} \; |
This file contains hidden or 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
# When does cron.daily, cron.hourly, etc. run on a system? | |
grep run-parts /etc/crontab |
This file contains hidden or 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 . -type f ! -regex ".*\/\.svn\/.*" -exec dos2unix {} \; |