Sunday, January 24, 2010
Find FTS servers that can't talk to a myproxy
for i in `grep 2010 download-fts |grep lcgrbp01|awk -F policy '{print $2}' |sort|uniq|awk -F \" '{print $2}'`; do grep $i download-fts |tail -1|awk -F FileDownload '{print $1}';echo $i; done
Friday, November 06, 2009
VNC to work machine
I always forget how to do VNC over SSH (despite having a handy alias set up for it...), so here's how to set it up.
- run vncon on the host (alias doing what's described on http://www.macosxhints.com/article.php?story=20080318190503111)
- run plaguevnc on the laptop to ssh tunnel vnc traffic
- connect to localhost:1212 in screen sharing
- do stuff... erm...
- run vncoff on the host
Thursday, August 27, 2009
rsync a directory to another destination
I wanted to sync up a directory on one machine to another, but I only wanted to transfer missing files (not updated) and to have the transferred files written to another directory (so I could easily find them and perform another action on them). The following mammoth incantation does the job:
This makes a bunch of empty directories (those that the --compare-dest contains but we don't write to), cleaning them up is as simple as:
rsync --verbose --progress --ignore-existing --stats --compress
--rsh=/usr/bin/ssh --size-only --compare-dest='~/Music/iTunes/iTunes\ Music/'
--recursive ~/Music/iTunes/iTunes\ Music/* macmini.local:'~/Desktop/incoming-music'
This makes a bunch of empty directories (those that the --compare-dest contains but we don't write to), cleaning them up is as simple as:
find Desktop/incoming-music/ -type d -print0 | xargs -0 rmdir -p
Wednesday, October 22, 2008
Add recent items to Dock
defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
I can't remember where I got this from, but the link in the title takes you to a page with more of the same....
As do:
I can't remember where I got this from, but the link in the title takes you to a page with more of the same....
As do:
Tuesday, September 02, 2008
Using find to delete files
I pretty much always forget how to use find. So here's how you delete a bunch of files (handy for those of us who sync things from a mac to a linux box):
find . -type f -name ".DS_Store" -exec rm -f {} \;
[from here]
find . -type f -name ".DS_Store" -exec rm -f {} \;
[from here]
Friday, June 27, 2008
Find and replace in files
Wednesday, March 12, 2008
Creating new tables from queries
The following is kind of handy:
create table new_table_name as select * from old_Table_name;
for instance:
create table phedex_node_cms_name_map as
select phedex_node.id as node_id, cms_name.id as CMS_NAME_ID
from phedex_node
inner join cms_name
on phedex_node.site = (select site_id from site_cms_name_map where CMS_NAME_ID=cms_name.id)
or even more awesomely:
create table phedex_node_cms_name_map as
select NODE_ID, CMS_NAME_ID from(
select phedex_node.name as node, cms_name.name as cmsname, phedex_node_cms_name_map_tmp.cms_name_id, phedex_node_cms_name_map_tmp.node_id
, regexp_substr(cms_name.name,'_[A-Z]+$',1)
from phedex_node
join phedex_node_cms_name_map_tmp on phedex_node_cms_name_map_tmp.node_id = phedex_node.id
join CMS_NAME on CMS_NAME.id = phedex_node_cms_name_map_tmp.cms_name_id
where phedex_node_cms_name_map_tmp.node_id in (
select node_id from (
select count(node_id) as count, node_id from phedex_node_cms_name_map_tmp group by node_id
) where count > 0
)
and
regexp_like (phedex_node.name,regexp_substr(cms_name.name,'_[A-Z]+$',1))
order by CMSNAME)
create table new_table_name as select * from old_Table_name;
for instance:
create table phedex_node_cms_name_map as
select phedex_node.id as node_id, cms_name.id as CMS_NAME_ID
from phedex_node
inner join cms_name
on phedex_node.site = (select site_id from site_cms_name_map where CMS_NAME_ID=cms_name.id)
or even more awesomely:
create table phedex_node_cms_name_map as
select NODE_ID, CMS_NAME_ID from(
select phedex_node.name as node, cms_name.name as cmsname, phedex_node_cms_name_map_tmp.cms_name_id, phedex_node_cms_name_map_tmp.node_id
, regexp_substr(cms_name.name,'_[A-Z]+$',1)
from phedex_node
join phedex_node_cms_name_map_tmp on phedex_node_cms_name_map_tmp.node_id = phedex_node.id
join CMS_NAME on CMS_NAME.id = phedex_node_cms_name_map_tmp.cms_name_id
where phedex_node_cms_name_map_tmp.node_id in (
select node_id from (
select count(node_id) as count, node_id from phedex_node_cms_name_map_tmp group by node_id
) where count > 0
)
and
regexp_like (phedex_node.name,regexp_substr(cms_name.name,'_[A-Z]+$',1))
order by CMSNAME)
Subscribe to:
Comments (Atom)