Skip to content

Instantly share code, notes, and snippets.


Jason Milkins jasonm23

View GitHub Profile
jasonm23 / sed examples.markdown
Created May 10, 2010
Column edits with sed / regexp
View sed examples.markdown

Ignore this - but if you are looking to do column edits, use unix cut it's made for this job.

Column edits with sed

Assuming you have a regular tabulated text file, e.g. a directory listing.

Extract columns from 15 - 29 for the entire input. ls -l | sed 's/(^.{14})(.{14})(.*)/\2/' # ^---^ ^---------^ ^--------^ ^---^ ^ # input \1= \2= \3= +---- output only \2 (c15-c29)

View Handy one-liners for SED.markdown
jasonm23 / Flex_Update_Code_Tasks.js
Created May 11, 2010
#Eclipse Monkey, #FlexBuilder: Find @todos and @FIXMEs in *.as, *.mxml & *.css, then add/update tasks
View Flex_Update_Code_Tasks.js
* Menu: Flex > Tasks
* Kudos: Jason Milkins
* License: EPL 1.0
* DOM:
* Eclipse Monkey script for FlexBuilder.
* Find @TODOs and @FIXMEs in *.as, *.mxml & *.css, then add/update tasks
function main() {
jasonm23 / get unique setting names from config master.
Created May 13, 2010
get unique setting names from config master
View get unique setting names from config master.
cat config_en.xml | grep -o -e '<setting key="[^ ]*"' | sort | uniq | sed -e 's/[^\=]*="\([^"]*\).*/\1/'
View Todays bash one
grep '<eventImage' config_en.xml | sed -e 's/[^\=]*\="\([0-9]*\)" value\="\([^.]*\)\.png"\/>/\1 \2/' | cat -n | wra b c; do echo "INSERT INTO event_type_numbers VALUES($a, '$b', '$(ds)', '$(ds)', 1, $(grep $c types.txt | sed 's/\([0-9]*\).*/\1/'));"; done
# find <eventImage nodes and grab their name value pairs, add line numbers, while read and split into a, b, c, (alias wra) then create a sql insert, $(ds) is a datestamp alias, then define the last column by searching for the image name in a list called types, and insert the associated ID num. and done.
View hobo.css
html, body {color: #193440; background: url(../images/300-ACD3E6-fff.png) repeat-x #fff; }
.page-header {color: white; background: url(../images/101-3B5F87-ACD3E6.png) repeat-x #3F606E;}
.page-header .navigation.main-nav a {
background: url(../images/30-3E547A-242E42.png) repeat-x #242E42;
.page-header .navigation.main-nav li.current a {
color: #222;
background: url(../images/30-DBE1E5-FCFEF5.png) repeat-x #FCFEF5;
border-top: 1px solid white;
border-left: 1px solid white;
View SockPost
configId = Configuration.find(:first).id
c = Configuration.create Configuration.find(:first).attributes
klasses = [Menu, Translation, BookingMarketName, CornerMarketName, ScoreMarketName, Service, AllowDomain]
klasses.each { |klass|
klass.find(:all, :conditions => { :configuration_id => configId } ).each { |item|
o = klass.create item.attributes
o.configuration_id =
View convert.rb
# convert a legacy config.xml
require 'rubygems'
require 'active_support'
require 'rexml/document'
include REXML
stdin =
jasonm23 / SockPost
Created May 25, 2010
Rename to pattern with bash/for loop
View SockPost
for a in `ls` ; { mv $a ${a//pattern/replace} };