You are viewing [info]studiojanck's journal

Brainchildren of the Demented [entries|archive|friends|userinfo]
studiojanck

[ Website - Studio Janck Homepage ]
[ Userinfo - Livejournal Userinfo ]
[ Archive - Journal Archive ]
[ - Storm of Bullets ]
[ - Kongregate ]

Cog's PowerShell Corner: The Revenge [Date: Thursday, 10/22/2009 | Time: 0855.00]
[Tags|, , , , , ]

Hey Paisanos! It's Cog's PowerShell Corner!
Yes, again. I refuse to shut up.

Today's word is: Execution.
As in running a program. Not the other kind.

Running a program, DOS-style

Code:
function Invoke-Shell ([string]$command, [string]$params, [switch]$raw)
{
  if (-not $raw)
  {
    $command = "`"$command`" $params"
  }
 
  cmd.exe /s /c "`"$command`""
}


This function allows you to safely call outside programs and DOS commands without the chances of having them be misconstrued as a cmdlet, function, or alias. If the -raw switch is specified, the command parameter is treated as the command line (which means the application name must be in quotes).
I recommend making an alias for this named "cmd" or "run".

Running a program as a new process

Code:
function Start-Process ([string]$application, [string]$params)
{
  [System.Diagnostics.Process]::Start($application, $params) | out-null
}


I recommend making an alias for this named "start".

These are simple functions. You'll probably want to combine the two and simply use the System.Diagnostics.Process class, while allowing for extra parameters for whether or not to start it as a new process and the execution environment.

Tip of the day

Variables will be expanded in double-quoted strings, e.g. "You are $age years old.". This works for variables with scopes and namespaces (such as $env:path or $global:foo), but it does not allow you to expand object members (e.g. "$foo.bar"). However, you CAN expand object members and evaluate expressions in a string by using a dollar sign and parenthesis, as shown here:
"$($foo.bar)"
"$(get-item $name)"
"$($a + $b)"
LinkLeave a comment

Cog's PowerShell Corner [Date: Wednesday, 10/21/2009 | Time: 0858.00]
[Tags|, , , , , , ]

I've been getting into PowerShell recently. It's awesome. But sometimes it doesn't seem to have all the functions that one would want. So I made my own. I've decided to dust off the ol' blog to tell you about how awesome I am some of the more useful functions. There's no guarantee that these won't malfunction when used in extreme ways (a pipe in a ForEach-Object in a pipe in a function), but there you go.

Dual Filter


(PowerShell 2.0 CTP 1 only, as far as I can tell)
Will automatically generate a Cmdlet from a script block. It's an easy way to make a filter that doubles as a function, or a function that accepts pipeline input. It all depends on how you look at it.

Code:
function DualFilter ([string]$name, [string]$params, [scriptblock]$filter)
{
  if ($params -ne "") {$params = ", $params"}
  $params = "param( [ValueFromPipeline][object]`$_ $params )"
  invoke-expression "cmdlet global:$name {$params process {$filter}}"
}


It can then be used like so:
DualFilter Write-Colored '[ConsoleColor]$color' {
  Write-Host $_ -foregroundcolor $color
}

Note that the opening brace must be on the same line as the DualFilter statement.

Including Scripts


With the advent of "Modules" in PowerShell 2.0 CTP 2, this may not be necessary for much longer.

Code:
function include ([string]$path)
{
  get-item "$path.ps1" | foreach-object {. $_.FullName}
}


Usage:
. include "c:\ps\*"

Scripts can be included by an absolute path or by wildcard. The ".ps1" extension should be omitted.

Tip of the Day


You can make an alias for a script file by writing Set-Alias <name> <path>
LinkLeave a comment

DigiPen orientation: day one [Date: Wednesday, 09/02/2009 | Time: 1344.00]
[Tags|]
[Mood |optimisticoptimistic]

First day of orientation and I already know that I'm going to love this place. Reasons listed below.

In general:

1. Every conversation I had, whenever I thought to ask someone about something, they would ask it first.

2. Almost everyone has a similar oddball sense of humor.

The undergrad welcoming session:

3. The first 10 minutes of the undergrad welcoming session was spent on video game trivia. With candy for prizes.

4. "Please, treat the campus like it was your house... er, actually... treat it like it was your PARENT'S house."

General question and answer session:

5. These conversations:
Helper 2: Is this the place for general questions?
Helper 1: Generally, yes.
Helper 2: Then can I generally sit here and help?
Helper 1: If you want to, in general.

Me: So how general can these questions be? Like, should I put money down for an XBOX 360?
Helper 1: That's a good question. You see, the things you need to think about are how much you REALLY want one, how much time do you have to spend on it, and whether or not it's within your budget.
Helper 2: If you think about it, you won't have much time to mess around with it in DigiPen.
Helper 1: Yeah, that's a good observation.
Helper 3: (deadpan) The answer is no.

Getting student IDs:

6. Someone there kept asking the people getting their picture taken to "strike a pose." Most of them did.

7. The photographer told everyone to say "fuzzy pickles" when he was taking their picture. Someone asked him about it, and he said "I'm going to keep doing it until someone gets where it's from." I spoke up, and he just pointed at me and said "YES."

I'm going to love college ;_;

Edit: I forgot this last one:

8. At one point, several people carrying boxes for Macintosh computers passed through the room. Someone shouted "ARE YOU TRYING TO START A FIGHT? I'LL TOTALLY TAKE YOU ON!"
LinkLeave a comment

Lifelong dream [Date: Wednesday, 06/10/2009 | Time: 2214.00]
[Tags|, ]
[Mood |accomplished]

 Gentlemen, I have an announcement.
I have finally achieved my lifelong dream of owning a fedora.
That is all.
LinkLeave a comment

Wings [Date: Monday, 04/20/2009 | Time: 1624.00]
She replaced your body
With cogs, gears, and springs
Saving your life
And giving you wings

May your hands fly true
And your body soar
Or your fragile world
Will be no more

Move quickly, make haste
Her time's drawing near
Your last chance to save
That which you hold dear


Annette is loathed deeply
By one once deceased
His name, long forgotten
Now Agony, the beast

When she saved his life
Annette's work was in vain;
Losing his body
Soon drove him insane

His humanity lost
A deranged psychopath
Mind and form twisted
By unholy wrath


Is she an angel
Of life, giving wings?
Or is she a demon
Who is pulling the strings?
LinkLeave a comment

I ATEN'T DEAD [Date: Tuesday, 04/15/2008 | Time: 0919.00]
Sorry for the lack of posts, my possibly multiple viewers. The next chapter is coming up soon. THERE WILL BE EXPLOSIONS!

Until then, have a list of all the things that are constantly running through my head:

Subzero: Origins (Tentative title) - Action/RPG
Subzero: Stratego (Tentative title) - Real-time strategy
Subzero: Apocalypse - Domination of All Mankind - Danmaku/Bullet Curtain
Ground Zero: Building 47 - Survival horror/Room escape
Ground Zero: Machinations - Platformer
Ground Zero: Final Mission - Vertical scrolling shoot-em-up
Zero Hour: Focal point (Tentative title) - Third person shooter

Spinoff games (Zero Relevance, if you will):
Marionation - Puzzle/platformer
Panic! Shooter - Arena shooter

I will personally be amazed if more than two of these see reality.

Edit: Changed some names
LinkLeave a comment

Short intermission [Date: Sunday, 01/27/2008 | Time: 2025.00]
SOM > Nothing interesting happens for a few days after this, so let's skip ahead...

COG > Somnus, there's nobody to talk to. Go back to sleep.

SOM > Done and done.

WARNING: UNIT "SOMNUS" IS NOT RESPONDING

SPEC > Like a baaaaaaby.





The console had been set to "Reports Only" a while ago.

REPORT FROM UNIT "SPECULUS"

DETAILS: Woman disregards advice and gets run over by truck. Killed instantly.

PENDING REVIEW


They were still sore about it. Her mind wandered a bit. Come to think of it, this was supposed to be a serious and life-threatening mission, but lately... well, the "59 days without us all getting killed" sign in the mess hall said it all, really. Has the American government still not figured it out yet? The sage drive hasn't reported anything-

REPORT FROM UNIT "SOMNUS"

DETAILS: Crew killed in devastating attack by poodles. No survivors.

COG: There are no poodles in space!

SPEC: At least, none that I've seen.

ESTIMATED PROBABILITY: 0.1%


...useful since this mission started, unless, of course, you counted the "Constipation epidemic due to expired cheese" report. Even then, the real culprit turned out to be low fiber. Maybe it's broken?

ADDENDUM: Invisible poodles.

SPEC: ...

COG: No. Go back to sleep.

ESTIMATED PROBABILITY: 0.001%


As Cognitus would say, "That's still to be determined."

Well, there goes that tangent. She looked around. Everyone had already left their stations. Everyone else go to sleep in their bunks. Well, she did keep signing up for this, so it was her own fault, really, but still. She should get a medal or something. Or better yet, she shouldn't, because if she did they would have to look up her file...

She yawned. 3 channels and there's nothing on. Try to stay awake, try to stay awake, try... to... stay...
Link

She woke up. [Date: Wednesday, 01/16/2008 | Time: 1733.00]

She was resting her head in her hand. She had fallen asleep again. Hopefully they had not, against all evidence, all been killed in one easily avoidable fell swoop because she was sleeping on Sage Drive duty. She checked the screen, just in case.

SAGE_DRIVE >> TERMINAL_BRIDGE_07 SPEC > You're sleeping, did you know that? COG > Humans often need sleep. SOM > Hey, she sleeps too? Amazing!

Top secret cutting-edge future prediction technology, she thought. Like magic, more text appeared.

SAGE_DRIVE >> TERMINAL_BRIDGE_07 SPEC > Prototypes. We're prototypes. SOM > That explains EVERYTHING!

The beauty of it all, the text-based interface. Nothing to get in the way of... of...

She reflected on how she had almost managed to convince herself that the Sage Drive made good conversation.

Her slightly depressing reverie was interrupted by a muffled cheer. Her chair squeaked as she turned to look around. No one else was on the bridge. They were having another party. With a sigh, she activated the communication utility. Better than mind-reading.

TERMINAL_BRIDGE_07 >> SAGE_DRIVE How many times can you party in one month? COG > Is that a philosophical question? SOM > You would think they would run out of conical paper hats. And cake. Mmmm... cake... SPEC > Are you sure you're not just saying that because you got left out? No! Of course not! SPEC > Can't stand being away from him then?

The rest of the universe seemed to quickly recede into the darkness, especially everything below her stomach.

What? SPEC > The captain, Adam. You like him, don't you?

She waited for a period long enough to be acceptably considered a confused silence and responded:

Um, no. SPEC > My mistake... SOM > MYSTERIOUS ELLIPSIS!

Her bewilderment at this strange interjection was cut short, as she noticed that the noises were starting to get closer. People were singing. Eventually, she was able to make out the words.

"Let's ruin the reputation of the good ol' USA
They lied to all of us and now there will be hell to pay
Expose the lies, present the truth, and then be on our way
There's things we'd rather do~"
Battle hymn of the republic? SOM > MENTALLY INSERTED TILDE! COG > SHUT UP! SPEC > Shush children, the chorus is starting!
"Jury jury let 'em fool ya
Them and Fuhrer Schicklgruba
We'll expose them, promise to ya
'Cuz that's just what we do!"

The door to the bridge opened, and the singing broke into a sea of background noise as people dispersed and sat down.

Schicklgruber? COG > I believe they're referring to President Lexington. How do they know he's involved? SPEC > How do you know he isn't? Will this go anywhere? COG > Probably not. SPEC > Hey, look! It's the captain! Blow him a kiss!

She didn't bother looking. She drew back her arm is if to punch the screen when Adam's voice came from behind her. "Sarah? Is something wrong?"

SPEC > The world is all wrong! You should be closer together! SOM > Hear hear!

She turned to the captain and waved nervously, while making a furious hand gesture behind her back towards one of the cameras on the bridge.

SPEC > Well that was uncalled for. COG > Oh, how things change... It seems like only yesterday that gesture took only one finger.
Link

She calmed down eventually. [Date: Wednesday, 12/12/2007 | Time: 1917.00]
[Tags|]

     Alex noted that 40 minutes had passed already, and that he should probably refrain from saying anything that wasn't strictly necessary. She started to speak again. "The three sages are missing. A cult known as the "Five Traits of Self-Preservation" are taking credit for it. We don't know their exact location, but we can give you some equipment which can help. We'll explain those later."
     "I will need a team."
     "You're in luck." She handed him a stack of files. He skimmed each one. A graduate of the N-MA university of magic, a graduate of N-SCI, and a... swordsman. A mage, a physicist, and a swordsman. A well-balanced team... but...
     "They're all female?"
     Julius frantically began, Don't ask what I think you're going to- 
     "Are you sure they're capable?"
     There was a snapping noise. Alex looked up.
     She had broken her pencil in half, and was giving him a blank stare.
     Alex carefully weighed his options, considered his objectives, and chose the best course of action.
     He left the office. 
Link

Alex cocked his head. [Date: Sunday, 12/09/2007 | Time: 1906.00]
[Tags|]

Julius was silent. She tried again. “The Earth, Grass, and Sky?” No. “Past, present, and future?” Still no. She sighed. “Cognitus, Speculus, and Somnus?” Ales spoke up. “Ah yes, them.” She began to grin. “I think it’s about time you learned the truth about them…”
     “They’re real,” he stated flatly.
     She stared at him. She closed her mouth, then opened and closed it a few more times. She recovered shortly. “How did you know that?”
     “I just do.”
     “Someone must have told you.”
     “It doesn’t matter… unless…”
     “Unless what?”
     “Mother was lying…”
     Her head hit her desk again. Alex turned to Julius. Should we leave and come back again?
     No need. This time she’s laughing.
Link

navigation
[ viewing | most recent entries ]
[ go | earlier ]