scripting

luaopen functions

我怕爱的太早我们不能终老 提交于 2019-12-12 15:19:11
问题 I found in the lua sample code these calls: luaopen_table(L); luaopen_io(L); luaopen_string(L); luaopen_math(L); I searched in lua header files and I found other functions with luaopen: LUALIB_API int (luaopen_base) (lua_State *L); LUALIB_API int (luaopen_table) (lua_State *L); LUALIB_API int (luaopen_io) (lua_State *L); LUALIB_API int (luaopen_os) (lua_State *L); LUALIB_API int (luaopen_string) (lua_State *L); LUALIB_API int (luaopen_math) (lua_State *L); LUALIB_API int (luaopen_debug) (lua

Piping Batch File output to a Python script

牧云@^-^@ 提交于 2019-12-12 14:14:14
问题 I'm trying to write a python script (in windows) that runs a batch file and will take the command line output of that batch file as input. The batch file runs processes that I don't have access to and gives output based on whether those processes are successful. I'd like to take those messages from the batch file and use them in the python script. Anyone have any ideas on how to do this ? 回答1: import subprocess output= subprocess.Popen( ("c:\\bin\\batch.bat", "an_argument", "another_argument"

where does msscript.ocx gets installed from

跟風遠走 提交于 2019-12-12 13:41:32
问题 I'm using msscript.ocx in my application which is an activex scripting host for windows. Although I want to be able to use the same for XP embedded(XPe) which's highly customizable. 1.I want to know whether on XPe, msscript.ocx can be optionally installed or not? 2.Where does it get installed from, IE? 3.Or is it a windows core component which gets installed during the XPe setup?(I know one can unregister it, but can it be an optional installation) Answering any or all of these questions will

Bash Scripting: How to patch files? (write a given string in a given position of a file)

强颜欢笑 提交于 2019-12-12 13:09:23
问题 Im writing a script to change the UUID of an NTFS partition (AFAIK, there is none). That means writing 8 bytes from 0x48 to 0x4F (72-79 decimal) of /dev/sdaX (X being the # of my partition). If I wanted to change it to a random UUID, I could use this: dd if=/dev/urandom of=/dev/sdaX bs=8 count=1 seek=9 conv=notrunc Or I could change /dev/urandom to /dev/sdaY to clone the UUID from another partition. But... what if I want to craft a personalized UUID? I already have it stored (and regex

What happens when I execute a unix shell script using a '.' command?

坚强是说给别人听的谎言 提交于 2019-12-12 12:31:30
问题 For e.g., when I say ". .bashrc" on my linux command prompt, is there a corresponding binary/script that gets executed in place of the first dot? If the dot itself is a command, where is its location? 回答1: The . operator is shorthand for the source Bash builtin (as pointed out by John Kugelman below). Typing help . or help source at the Bash prompt will give you some information. For more on how source works, see http://www.ss64.com/bash/period.html. 回答2: Additionally I want to point out that

Pros/cons of embedded scripting environments?

旧城冷巷雨未停 提交于 2019-12-12 12:27:02
问题 There are several scripting environments available for .NET applications (e.g.this post). My question is, what are the pros/cons of using each of them? Examples include (but not limited to) PowerShell IronPython Lua JavaScript I am trying to decide which scripting tool to use in scientific applications to allow expert users to interact with complicated models such that they can create new algorithms. 回答1: I don't have experience embedding Powershell, but I'm going to assume it's a lot like

Select option on dropdown list for web ui testing automation in windows powershell

给你一囗甜甜゛ 提交于 2019-12-12 12:17:00
问题 Sorry if this is too easy of a question, but I'm fairly new to Windows Powershell and all of the tutorials I've looked at for dropdown lists show you how to display one to the user. Anyway what I am trying to do is test my web application using Powershell. I need to change a dropdownlist to a specific choice, I can use the value or index to do this it doesn't matter to me. Thanks for any help you can give. 回答1: Turns out the easiest way to do it was to just set the value of the control to the

spawn_id: spawn id exp6 not open

眉间皱痕 提交于 2019-12-12 11:37:35
问题 I know that this issue is already mentioned here, but the solution does not work for me. I have this script (let's name it myscript.sh) that spawns a process on remote environment and that should interact with it. #!/usr/bin/expect log_user 0 set timeout 10 spawn ssh -o PubkeyAuthentication=no [lindex $argv 0] -n [lindex $argv 1] expect "password:" {send "mypassword\r"} expect "Continue to run (y/n)" {send "n\r"} interact When I call this script on local environment... myscript.sh user@host

Ruby scripts with access to Rails Models

女生的网名这么多〃 提交于 2019-12-12 10:59:05
问题 Where and how do I run a simple script that uses my rails environment. Specifically I have one column that holds multiple pieces of information, I've added columns now for each piece of information and need to run a ruby script that can run to call a method on each row of the database to extrapolate data and save it to the new column. 回答1: I have to agree with David here. Use a migration for this. I'm not sure what you want to do, but running it from inside your environment is much, much more

String comparison not working in PowerShell function - what am I doing wrong?

倖福魔咒の 提交于 2019-12-12 10:54:32
问题 I'm trying to make an alias of git commit which also logs the message into a separate text file. However, if git commit returns "nothing to commit (working directory clean)" , it should NOT log anything to the separate file. Here's my code. The git commit alias works; the output to file works. However, it logs the message no matter what gets returned out of git commit . function git-commit-and-log($msg) { $q = git commit -a -m $msg $q if ($q –notcontains "nothing to commit") { $msg | Out-File