Posts Tagged ‘ bash ’

Bash script to batch obliterate revisions with p4 perforce

Aug 3rd, 2017 | By

Ok, so you have a project with a 1GB file and the devs have committed 120 revisions of that file, meaning they are probably taking up somewhere between 50-100GB worth of space on the server.  One option is to nuke the file entirely and re-upload it but then you look the version history and it’ll
[continue reading…]



Automatically block aggressive IPs to prevent brute force or DDOS attacks using Bash and IPtables

Oct 11th, 2014 | By

Something I do, mainly because of my ignorance of a more elegant solution, is to manually check my logs every 4 hours and the mail server logs every 2 minutes for excessive access by individual IP’s. I run a few scripts together that: Check the access.log and list off the top 10 IP’s organized by
[continue reading…]



How to find incremental numbers in a file and increase them by a certain amount with perl and SED

Mar 7th, 2014 | By

So let’s say you have a file and in it is ton of field ID’s, something like this  <field id=”68″ size=”medium” type=”checkbox”> What you want to do is take the first 68 of these fields as well as all of their code and then append these new 68 fields and all of their code onto
[continue reading…]



Batch renaming files in Sequential order with Bash(in windows)

Mar 4th, 2013 | By

So let’s say you save 50 related files from the internets and they are all uselessly named like ksaljf23_13.jpg , etc etc and you want them to be sequentially named something relevant like videoGame_01.jpg videoGame_02.jpg oxycontin.  How can you go and batch rename them all with a quick and dirty script? Well in linux it’s
[continue reading…]



Database wide search and replace script

Aug 21st, 2012 | By

Just something I thought that I would post as I needed a quick solution to do a search and replace of an entire Mysql Database.  It’s actually dumping the DB, searching and replacing the dump file and then re-importing it.  But it does the trick   #!/bin/bash if (($# >= 1)) ; then if (($#
[continue reading…]



How to batch convert .xm / .mod files to .wav files in linux

Mar 11th, 2012 | By

Well funny enough I had given up on this because of so many forum posts that I found saying it cant’ be done and that you need windows bla bla bla.. Well they are all a bunch of chumps because there is a native linux solution that is easier and quicker than anything you can
[continue reading…]



Your own free content spinner shell script in bash (fTW!)

Apr 18th, 2010 | By

So today I set out to modify my massive unique tweet and content generator for my Netsyphon network(ie: hotel-kelowna, innkelowna.com, kelownasrestaurants.com, etc etc) and add an inline content spinner to it.  To date there are a lot of search/replaces happening but they are all one time replaces and reference external files for the replace values.. 
[continue reading…]