scripting

Download from EXPLOSM.net Comics Script [Python]

烂漫一生 提交于 2020-01-14 04:59:43
问题 So I wrote this short script (correct word?) to download the comic images from explosm.net comics because I somewhat-recently found out about it and I want to...put it on my iPhone...3G. It works fine and all. urllib2 for getting webpage html and urllib for image.retrieve() Why I posted this on SO: how do I optimize this code? Would REGEX (regular expressions) make it faster? Is it an internet limitation? Poor algorithm...? Any improvements in speed or general code aesthetics would be greatly

How to use Roslyn C# scripting in batch processing with several scripts?

天大地大妈咪最大 提交于 2020-01-13 16:29:13
问题 I am writing multi-threaded solution that will be used for transferring data from different sources to a central database. Solution, in general, has two parts: Single-threaded Import engine Multi-threaded client that invokes Import engine in threads. In order to minimize custom development I am using Roslyn scripting. This feature is enabled with Nuget Package manager in Import engine project. Every import is defined as transformation of input table – that has collection of input fields – to

Looking for a locked down script interpreter [closed]

孤街浪徒 提交于 2020-01-13 13:45:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm looking for a .NET library that does a specific task. Say my app has been sent a program (in some script language) and I want my app to run that script. That script could come from an openly hostile individual, but I want to run it anyway. (Like JavaScript in a browser.) var sc = new SecureScript(

SecurityException in Sandboxed AppDomain

百般思念 提交于 2020-01-13 10:15:10
问题 I'm attempting to use C# as a scripting language using CSharpCodeProvider (using VS2010 and .NET 4.0). I want the scripts to be run in a restricted AppDomain with minimal permissions. Currently, I'm getting an exception while trying to instantiate a class in the AppDomain (The call to CreateInstanceAndUnwrap() ). Here is some simplified code that reproduces the exception: using System; using System.Collections.Generic; using Microsoft.CSharp; using System.CodeDom; using System.CodeDom

How to conditionally add flags to shell scripts?

拜拜、爱过 提交于 2020-01-13 09:34:36
问题 I want to run a command inside my bash script with or without a -v flag depending on if the environment variable $VERBOSE is defined. Something like this: #!/bin/bash /usr/local/bin/mongo-connector \ -m $MONGO_HOST \ -t $NEO_URI \ [if $VERBOSE then -v ] \ -stdout 回答1: #!/bin/bash /usr/local/bin/mongo-connector \ -m $MONGO_HOST \ -t $NEO_URI \ ${VERBOSE:+-v} \ -stdout If VERBOSE is set and non-empty, then ${VERBOSE:+-v} evaluates to -v . If VERBOSE is unset or empty, it evaluates to the empty

enabling tty in a ssh session

China☆狼群 提交于 2020-01-12 08:47:09
问题 I would to take in some login information for a script have written in to be used by many users. In python I set the input_raw to read from dev/tty but it fails horribly when i am connecting to the script being run on a server through ssh. Thoughts? Workarounds? I would prefer to avoid hard coding usernames into the script. Please and thank you. 回答1: Try using the -t option to ssh: -t Force pseudo-tty allocation. This can be used to execute arbi- trary screen-based programs on a remote

how to write a bash script like the ones used in init.d?

孤人 提交于 2020-01-12 07:48:07
问题 I have to write a bash script that makes lot of things. I'd like to print messages as nice as init scripts do. For example: Doing A... [OK] Doing B... [ERROR] .... Do you know any way to make this? Thanks in advance 回答1: On all my Linux boxes, the code to do that is in the file: /etc/init.d/functions If you include that file ( . /etc/init.d/functions ) and then run your code doing this: action /path/to/prog args you will get the functionality you want. 回答2: The /etc/init.d/* scripts follow a

How can I prompt for yes/no style confirmation in a zsh script?

社会主义新天地 提交于 2020-01-12 05:41:07
问题 Using zsh, I'm trying to put a step in my ~/.zprofile where I interactively ask a yes/no style question. At first I tried this bash-style approach, but I saw errors of this form: read: -p: no coprocess (I'm aware that typically the zsh syntax is different from bash's - I tried preceding it with a sh emulation command - emulate -LR sh - but it made no difference). This page implied the syntax might be different, so guided by this page and the zsh man page, I tried this instead: read -q REPLY?

Windows batch - concatenate multiple text files into one

馋奶兔 提交于 2020-01-12 02:41:45
问题 I need to create a script, which concatenates multiple text files into one. I know its simple to use type *.txt > merged.txt But the requirement is "concatenate files from same day into file day_YYYY-DD-MM.txt" I am linux user and windows batch is hell for me. EDIT: Its Windows XP 回答1: Windows type command works similarly to UNIX cat . Example 1: Merge with file names (This will merge file1.csv & file2.csv to create concat.csv) type file1.csv file2.csv > concat.csv Example 2: Merge files with

VB Script does not recognize the actual parameter

谁说我不能喝 提交于 2020-01-11 13:03:20
问题 I've two VB Scripts. Say First.vbs and Second.vbs . Frist.vbs calls Second.vbs each time some action/event happens. I am trying to send two parameters from Frist.vbs to Second.vbs using the following code: Contents of First.vbs : Set objShell = Wscript.CreateObject("WScript.Shell") param1 = "Welcome" param2 = "Gokul Nath" objShell.Run "Second.vbs" & " " & param1 & " " & param2 Set objShell = Nothing Contents of Second.vbs : param1= Wscript.Arguments.Item(0) param2 = Wscript.Arguments.Item(1)