This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Introduction
In this post we analyze the following command which allows you to run “top interactively without having to look up the pids” your interested in.
top -p `pgrep process-name | tr "\\n" "," | sed 's/,$//'`
Analysis
The command is split into multiple sub commands.
top:displays running processes. With -p option means monitor specific process IDs.
pgrep: Looks through the currently running processes and lists the process IDs which matches the selection criteria (proccess-name).
pipe (|): The pipe operator. It is used to direct the stdout of the first command to the stdin of the second command.
tr (translate): Is used for replacing or removing specific characters in its input data set. Above: linefeed(\n) is replaced with comma(,) .
sed: sed is used to remove the last comma(,) for the list. Sed is a stream editor which are used to perform basic text transformations on an input stream (a file or input from a pipeline). sed‘s ability to filter text in a pipeline particularly distinguishes it from other types of editors.
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
This is a quick post about creating dispatching events using javascript and specifically key press events (for use with greesemonkey or whatnot and firefox).
Note that this will not work for the latest versions of firefox in many instances. I believe this is due to security updates.
Personally I am using this dispatch keypresses to google docs from a greesemonkey script.
Below the code for typing “hello world” to google docs from a greesemonkey user script.
I suspect there may be a more efficient ways though I noticed not all browsers support the same API 🙁 . Specifically, on http://help.dottoro.com/ljbwbehw.php we see that initKeyEvent is only available in firefox. On the other hand, initTextEventis available in IE, chrome, and Safari.
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
I Wanted to do some maintenance and move my couchdb data files to another partition but couchdb would not stop when I called the usual stop commands:
1)sudo /etc/init.d/couchdb stop
2)sudo service couchdb stop
Found a lot of posts and out of all of them found this nice tidbit below:
ps -U couchdb -o pid= | xargs kill -9
Note: It’s not the best thing to viciously kill a process. I imagine databases usually have shutdown tasks to do, must end with current insertions, etc. I’ll post if I find a bug fix.
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Excel VBA
Description:
This is a sample script showing how I pull web-banking balances off the internet when I want to have a total picture of how my finances are. For the boring reasoning go to the last page. Otherwise technical details follow.
Project References:
Add the following to the references for this to work:
-Microsoft HTML Object Library
-Microsoft Internet Controls
VBA references
Code:
The code below is an example of how to do this missing error handling. As it uses IE, it saves the developer the task of implementing SSL in VBA.
Navigating the Site
Public oBrowser As InternetExplorer
Sub Login_2_Website()
Dim oHTML_Element As IHTMLElement
Dim sURL As String
Dim text As String
Dim avarSplit As Variant
sURL = "https://secure.alpha.gr/e-services"
Set oBrowser = New InternetExplorer
oBrowser.Silent = True
oBrowser.navigate sURL
oBrowser.Visible = True
Do
' Wait till the Browser is loaded'
Loop Until oBrowser.readyState = READYSTATE_COMPLETE
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__userName").Value = "USER"
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__Pswd").Value = "PASSWORD"
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_NewLayoutSignOn__login").Click
Do
' Wait till the Browser is loaded'
Application.Wait DateAdd("s", 0.1, Now)
Debug.Print (oBrowser.document.readyState)
Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"
oBrowser.navigate "https://secure.alpha.gr/e-services/AWBPage.aspx?service=balancesStatements"
Do
' Wait till the Browser is loaded'
Application.Wait DateAdd("s", 2, Now)
Debug.Print (oBrowser.readyState)
Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"
Application.Wait DateAdd("s", 2, Now)
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__productsPagedDropDownList__selectionList").selectedIndex = 1
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__productsPagedDropDownList__selectedIndexHiddenField").Value = "1"
oBrowser.document.all.Item("_contentPlaceHolder__loadedControl_balancesStatements__balancesButton").Click
Do
' Wait till the Browser is loaded'
Application.Wait DateAdd("s", 0.1, Now)
Debug.Print (oBrowser.document.readyState)
Debug.Print (oBrowser.LocationURL)
Loop Until oBrowser.document.readyState = "complete"
getBalance
End Sub
This specific content was written 14 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Dear All,
Quick little post about a small script I made for backing up some files from a webserver (hosting apache+mysql).
I wanted a script which would remind me to backup whenever I would log onto the specific machine.
I would have preferred automated but I’m a little paranoid about security. Why?
I don’t want to automatically compromise the security of a public webserver if another computer is hacked…so even if the backup server is hijacked no certificate/password will be stored.
Hence running the backup script required an actual user to type in the password.
This specific content was written 15 years ago.
Please keep this in mind as it may be outdated and not adhering to best-practices.
Specifically I’m going to talk about the Huawei MIFI (Mobile 3G Wifi) E585 though these could be applied to another access point/ mifi. You will need the web debugger FIDDLER (a http request sniffer).
So, probably your MIFI/access point is configured with IP address 192.168.1.1 .
If there are pages that display the statistics (such as those on the E858) there is a chance the information can be accessed through a .php or other dynamic page.
On the E858, accessing http://192.168.1.1/ displays the current total download/upload and flux for the current session. (pictures coming later).
However, if you want to check more analytical statistics such as total usage you have to log on. Fortunately, if the data screen uses a JQuery (or javascript ajax script) fiddler can be used to sniff and discover the data source (post me a line for more instructions).
This blog is related to topics about operating systems, development, coding, and software and
contains our own opinions, code, and examples unless otherwise stated.
It is also a work in progress - so bear with us as we improve the template and content.
Jul 1 2012
Limiting TOP command to a specific process name and keeping interactivity
Introduction
In this post we analyze the following command which allows you to run “top interactively without having to look up the pids” your interested in.
Analysis
The command is split into multiple sub commands.
By Menelaos Bakopoulos • Linux, Scripts 0