doc_id
stringlengths 36
36
| metadata
dict | input
stringlengths 28
4.3k
| output
stringlengths 11
5.45k
|
---|---|---|---|
61b1301c-7ef9-4c3a-9b68-9664bf88bd99 | {
"language": "AutoHotkey"
} | ```autohotkey
```
Add simple AHK script to test mouse wheel jumping | ```autohotkey
~WheelDown::
GoingDown := True
if GoingUp
{
MsgBox, , Problem, Mouse wheel is jumping
VarSetCapacity(GoingDown,0)
}
return
~WheelUp::
GoingUp := True
if GoingDown
{
MsgBox, , Problem, Mouse wheel is jumping
VarSetCapacity(GoingUp,0)
}
return``` |
13f22ec8-1751-401a-b8c8-ef6fa326b77f | {
"language": "AutoHotkey"
} | ```autohotkey
```
Update for new login window | ```autohotkey
email = %1%
passwrd = %2%
Checkd()
{
WinWait Blizzard App Login, ,3
WinMove 0, 0
WinActivate
IfWinNotActive
{
Checkd()
}
if ErrorLevel
{
MsgBox unable to find Battle.net login window. Please record trying to login and report it at j20.pw/bnethelp
exit
}
}
Checkd()
Sleep 2000
Checkd()
WinActivate
Checkd()
ClickFromTopRight(42,200)
Send ^a
Send {BS}
send %email%
sleep 20
Sleep 100
ClickFromTopRight(42,250)
Sleep 20
ClickFromTopRight(42,250)
Send ^a
Send {BS}
send %passwrd%
Send {Enter}
exit
ClickFromTopRight(_X,_Y){
CoordMode, mouse, Relative
WinGetActiveStats, Title, width, height, x,y
_X := width - _X
Click %_X%, %_Y%
}
``` |
524a4cc2-e528-429b-a7ba-a66eee5248e2 | {
"language": "AutoHotkey"
} | ```autohotkey
```
Add AHK for leftover debug dialog at completion of install/uninstall | ```autohotkey
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 1 ;matches if title begins with string
DetectHiddenText, off ;will not search hidden window text
DetectHiddenWindows, off ;will not detect hidden windows
WinWait, Sandboxie ahk_class #32770, DONE, 120
WinActivate
Send,{Enter}
ExitApp``` |
5fbf9edf-1d61-4d8f-b48b-141295dce7c3 | {
"language": "AutoHotkey"
} | ```autohotkey
```
Add a script to launch the 'keep window on top' from other programs | ```autohotkey
#NoTrayIcon
#Persistent
#SingleInstance force
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Send !+^{T}``` |
2479d4ea-d479-4658-8147-90fea72829cf | {
"language": "AutoHotkey"
} | ```autohotkey
```
Add AHK script to reset cursor position for all pages in a section | ```autohotkey
#NoEnv
#NoTrayIcon
#SingleInstance force
#Warn
SendMode Input
SetTitleMatchMode, 3
SetWorkingDir, %A_ScriptDir%
procName := "ONENOTE.EXE"
; Set cursor to page title for all pages in the current section
!q::
IfWinActive, ahk_exe %ProcName%
{
Send !{Home}
Loop, 31 {
Send ^+T
Send {Home}
Send ^{PgDn}
}
}
``` |
98f2c98a-8b3b-4b8c-b8d9-7a9ec4f9f2dd | {
"language": "AutoHotkey"
} | ```autohotkey
```
Add AutoHotkey configuration for np2 | ```autohotkey
; Muhenkan (PC98 NFER key)
LWin::Send {vk1D}
; Henkan (PC98 XFER key)
;RWin::Send {vk1C}
;^RWin::Send {vk1C}
AppsKey::Send {vk1C}
^AppsKey::Send ^{vk1C}
;Muhenkan / 無変換 -> {vk1D}
;Henkan / 変換 -> {vk1C}
;Kana / かな -> {vkF2}
;IME ON/OF -> {vkF3}, {vkF4}
``` |
c1b66b6d-4b34-4b57-829f-c45e7f128a29 | {
"language": "AutoHotkey"
} | ```autohotkey
```
Add small windows autohotkey script. | ```autohotkey
Capslock::Ctrl
; Window management
#h::SendEvent #{Left}
#l::SendEvent #{Right}
#j::SendEvent #{Down}
#k::SendEvent #{Up}
; Windows Explorer Navigation
#IfWinActive, ahk_class CabinetWClass
^h::
ControlGet renamestatus,Visible,,Edit1,A
ControlGetFocus focussed, A
if(renamestatus!=1&&(focussed=DirectUIHWND3?||focussed=SysTreeView321))
{
SendInput {Alt Left}
}else{
Send {Backspace}
}
#IfWinActive``` |
9fe0c943-789a-4c87-8921-aef0e05da8c7 | {
"language": "Awk"
} | ```awk
#!/usr/bin/awk -f
BEGIN {
# Determines whether to print 'Unreleased' banner at top
UNRELEASED_COMMITS = 1
# Prefixes that determine whether a commit will be printed
CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat): "
FS="|"
while ("git log --pretty='%D|%s|%H'" | getline) {
IS_GIT_TAG = length($1) && match($1, /tag:/)
if (IS_GIT_TAG) {
UNRELEASED_COMMITS = 0
# Cut out text up to tag
sub(/.*tag: /, "", $1)
# Cut out text after tag
sub(/,.*/, "", $1)
print $1
} else {
if ( UNRELEASED_COMMITS ) {
print "Unreleased"
UNRELEASED_COMMITS = 0
}
if ( match($2, CHANGELOG_REGEX) ) {
sub(CHANGELOG_REGEX, "", $2)
printf("\t- %s\n", $2)
}
}
}
}
```
Add new prefixes: feature, refactor and update | ```awk
#!/usr/bin/awk -f
BEGIN {
# Determines whether to print 'Unreleased' banner at top
UNRELEASED_COMMITS = 1
# Prefixes that determine whether a commit will be printed
CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat|feature|refactor|update): "
FS="|"
while ("git log --pretty='%D|%s|%H'" | getline) {
IS_GIT_TAG = length($1) && match($1, /tag:/)
if (IS_GIT_TAG) {
UNRELEASED_COMMITS = 0
# Cut out text up to tag
sub(/.*tag: /, "", $1)
# Cut out text after tag
sub(/,.*/, "", $1)
print $1
} else {
if ( UNRELEASED_COMMITS ) {
print "Unreleased"
UNRELEASED_COMMITS = 0
}
if ( match($2, CHANGELOG_REGEX) ) {
sub(CHANGELOG_REGEX, "", $2)
printf("\t- %s\n", $2)
}
}
}
}
``` |
f7bf21e4-6737-4a08-9d3e-3dad74fa93a4 | {
"language": "Awk"
} | ```awk
# awk script to convert symbol export table formats
# converts an msvc .def file to an darwin ld export-symbols-list file
# we only support the most basic module definition syntax
# skip comments
/^\w*#.*/ {next}
/^\w*;.*/ {next}
# remember and propagate the library name
/LIBRARY/ {name = $2; print "\# export list for", name; next}
# skip various other lines
/^\w*NAME/ ||
/^\w*VERSION/ ||
/^\w*EXPORTS/ ||
/^\w*HEAPSIZE/ ||
/^\w*STACKSIZE/ ||
/^\w*STUB/ {next}
# todo: handle SECTIONS
# for symbols, strip the semicolon and mangle the name
/[a-zA-Z]+/ {sub(/\;/, ""); print "_" $1}
# todo: warn if we see publicname=privatename mappings
# which other linkers don't support
```
Remove a redundant escape character. | ```awk
# awk script to convert symbol export table formats
# converts an msvc .def file to an darwin ld export-symbols-list file
# we only support the most basic module definition syntax
# skip comments
/^\w*#.*/ {next}
/^\w*;.*/ {next}
# remember and propagate the library name
/LIBRARY/ {name = $2; print "# export list for", name; next}
# skip various other lines
/^\w*NAME/ ||
/^\w*VERSION/ ||
/^\w*EXPORTS/ ||
/^\w*HEAPSIZE/ ||
/^\w*STACKSIZE/ ||
/^\w*STUB/ {next}
# todo: handle SECTIONS
# for symbols, strip the semicolon and mangle the name
/[a-zA-Z]+/ {sub(/\;/, ""); print "_" $1}
# todo: warn if we see publicname=privatename mappings
# which other linkers don't support
``` |
d1f6c1cd-d12e-4edf-8464-668666ad7c48 | {
"language": "Awk"
} | ```awk
# Print lines from a WebScraper csv file after joining extra newlines
# INVOCATION:
# awk -f fixExtraLinesFrom-webscraper.awk BritBoxPrograms.csv
{
if (/^"/)
printf ("\n" $0)
else
printf
}
```
Make sure newline at end of file | ```awk
# Print lines from a WebScraper csv file after joining extra newlines
# INVOCATION:
# awk -f fixExtraLinesFrom-webscraper.awk BritBoxPrograms.csv
{
if (/^"/)
printf ("\n" $0)
else
printf
}
END {
printf ("\n")
}
``` |
82f7fac8-f43e-4e7d-8cb9-b6fa95853bd8 | {
"language": "Awk"
} | ```awk
{
if (1==NR)
{
startTimestamp = substr($1, 2, length($1) - 2)
printf(";$FILEVERSION=1.3\n")
printf(";$STARTTIME=%u.%u\n", mktime(strftime("%Y %m %d 0 0 0", startTimestamp)) / 86400 + 25569, \
10000000000 / 86400 * (mktime(strftime("%Y %m %d %H %M %S", startTimestamp)) - mktime(strftime("%Y %m %d 0 0 0", startTimestamp))))
currentTimeOffset = 0.0
}
else
{
previousTimeOffset = currentTimeOffset
currentTimestamp = substr($1, 2, length($1) - 2)
currentTimeOffset = currentTimestamp - startTimestamp
if (currentTimeOffset < 0)
{
startTimestamp = currentTimestamp + currentTimeOffset
currentTimeOffset = previousTimeOffset
}
}
printf("%u) %.3f 1 Rx %s - %s", NR, currentTimeOffset * 1000, $3, substr($4, 2, length($4) - 2))
if (5<=NF)
{
for(i=5;i<=NF;i++)
{
printf " "$i
}
}
printf "\n"
}
```
Use float for calculating fractional part of STARTTIME to support busybox awk. Also print used start time is various representations. | ```awk
{
if (1==NR)
{
startTimestamp = substr($1, 2, length($1) - 2)
printf(";$FILEVERSION=1.3\n")
printf(";$STARTTIME=%u.%.0f\n", mktime(strftime("%Y %m %d 0 0 0", startTimestamp)) / 86400 + 25569, \
10000000000.0 / 86400.0 * (mktime(strftime("%Y %m %d %H %M %S", startTimestamp)) - mktime(strftime("%Y %m %d 0 0 0", startTimestamp))))
printf(";\n; Start time: %s\n", startTimestamp)
printf("; %u\n", mktime(strftime("%Y %m %d %H %M %S", startTimestamp)))
printf("; %s\n;\n", strftime("%Y-%m-%dT%H:%M:%S%z (%Z)", startTimestamp))
currentTimeOffset = 0.0
}
else
{
previousTimeOffset = currentTimeOffset
currentTimestamp = substr($1, 2, length($1) - 2)
currentTimeOffset = currentTimestamp - startTimestamp
if (currentTimeOffset < 0)
{
startTimestamp = currentTimestamp + currentTimeOffset
currentTimeOffset = previousTimeOffset
}
}
printf("%u) %.3f 1 Rx %s - %s", NR, currentTimeOffset * 1000, $3, substr($4, 2, length($4) - 2))
if (5<=NF)
{
for(i=5;i<=NF;i++)
{
printf " "$i
}
}
printf "\n"
}
``` |
8c938945-ac5d-4b67-a763-5c54621b5eb5 | {
"language": "Awk"
} | ```awk
#!/usr/bin/awk -f
BEGIN {
# Determines whether to print 'Unreleased' banner at top
UNRELEASED_COMMITS = 1
# Prefixes that determine whether a commit will be printed
CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat|feature|refactor|update): "
FS="|"
while ("git log --pretty='%D|%s|%H'" | getline) {
IS_GIT_TAG = length($1) && match($1, /tag:/)
if (IS_GIT_TAG) {
UNRELEASED_COMMITS = 0
# Cut out text up to tag
sub(/.*tag: /, "", $1)
# Cut out text after tag
sub(/,.*/, "", $1)
print $1
} else {
if ( UNRELEASED_COMMITS ) {
print "Unreleased"
UNRELEASED_COMMITS = 0
}
if ( match($2, CHANGELOG_REGEX) ) {
sub(CHANGELOG_REGEX, "", $2)
printf("\t- %s\n", $2)
}
}
}
}
```
Update to output in markdown format | ```awk
#!/usr/bin/awk -f
BEGIN {
REPO_URL = getRepoURL()
# Prefixes that determine whether a commit will be printed
CHANGELOG_REGEX = "^(changelog|fix|docs|chore|feat|feature|refactor|update): "
FS="|"
# %D: tags
# %s: commit message
# %H: long hash
# %h: short hash
while ("git log --pretty='%D|%s|%H|%h'" | getline) {
IS_GIT_TAG = length($1) && match($1, /tag:/)
if (IS_GIT_TAG) {
printTag($1)
} else {
printCommit($2, $3, $4)
}
}
}
function printTag(input) {
# Cut out text up to tag
sub(/.*tag: /, "", input)
# Cut out text after tag
sub(/,.*/, "", input)
printf("## %s\n", input)
}
function printCommit(input, longHash, shortHash) {
if ( match(input, CHANGELOG_REGEX) ) {
sub(CHANGELOG_REGEX, "", input)
printf("- %s (%s)\n", input, makeCommitLink(REPO_URL, shortHash, longHash) )
}
}
function makeCommitLink(repoUrl, shortHash, longHash) {
return ("[" shortHash "](" repoUrl "/commit/" longHash ")")
}
# Get Git repo URL
function getRepoURL() {
"git config --get remote.upstream.url || git config --get remote.origin.url || git config --get remote.dev.url" | getline REPO_URL
sub(/:/, "/", REPO_URL)
sub(/git@/, "https://", REPO_URL)
sub(/\.git/, "", REPO_URL)
return REPO_URL
}
``` |
0a758377-c5f9-4e60-9778-673179ed89b7 | {
"language": "Awk"
} | ```awk
#!/usr/bin/env awk -f
#
# Computes the median.
#
# Usage: median
#
# Input:
# - a column of numbers
#
# Output:
# - median value
BEGIN {
i = 0
}
{
a[i++] = $1
}
END {
j = i/2
if ( i%2 == 1 ) {
median = a[int(j)]
} else {
median = (a[j] + a[j-1])/2
}
print median
}
```
Clarify that input must be sorted | ```awk
#!/usr/bin/env awk -f
#
# Computes the median.
#
# Usage: median
#
# Input:
# - a sorted column of numbers
#
# Output:
# - median value
BEGIN {
i = 0
}
{
a[i++] = $1
}
END {
j = i/2
if ( i%2 == 1 ) {
median = a[int(j)]
} else {
median = (a[j] + a[j-1])/2
}
print median
}
``` |
5aad16c4-65ce-46e2-ab58-c30d285076d5 | {
"language": "Awk"
} | ```awk
BEGIN {
FS = "\n";
}
/Targets:/ {
while (getline && $0 != "") {
if ($0 ~ /Tests/) continue;
sub(/^ +/, "");
print;
}
}
```
Exclude any target with "Test" in the name | ```awk
BEGIN {
FS = "\n";
}
/Targets:/ {
while (getline && $0 != "") {
if ($0 ~ /Test/) continue;
sub(/^ +/, "");
print;
}
}
``` |
31fa18d1-a949-45ed-a9b0-5bde5c6761f4 | {
"language": "Awk"
} | ```awk
#!/usr/bin/awk
#
# Patch the generated wrapper Swift code to handle special cases
#
BEGIN { depr_init = 0 }
/open .* ColorSelection/ { depr_init = 1 }
/public .* ColorSelection/ { depr_init = 1 }
/public .* HSV/ { depr_init = 1 }
/open .* HSV/ { depr_init = 1 }
/ init.. {/ {
if (depr_init) {
printf("@available(*, deprecated) ")
depr_init = 0
}
}
/ init. title:/ {
if (depr_init) {
printf("@available(*, deprecated) ")
depr_init = 0
}
}
// { print }
```
Make this link against gtk+-3.24.4 | ```awk
#!/usr/bin/awk
#
# Patch the generated wrapper Swift code to handle special cases
#
BEGIN { depr_init = 0 ; comment = 0 }
/open .* ColorSelection/ { depr_init = 1 }
/public .* ColorSelection/ { depr_init = 1 }
/public .* HSV/ { depr_init = 1 }
/open .* HSV/ { depr_init = 1 }
/open .* HSV/ { depr_init = 1 }
/func getColumnHeaderCells/ { comment = 1 }
/func getRowHeaderCells/ { comment = 1 }
/ init.. {/ {
if (depr_init) {
printf("@available(*, deprecated) ")
depr_init = 0
}
}
/ init. title:/ {
if (depr_init) {
printf("@available(*, deprecated) ")
depr_init = 0
}
}
// {
if (comment) {
printf("// ")
}
print
}
/^ }$/ { comment = 0 }
``` |
47465dde-8bc2-46a9-ac95-7255d83e9194 | {
"language": "Awk"
} | ```awk
BEGIN {
print "V1.0 {";
print " global:";
}
{
# Remove the CR character in case the sources are mapped from
# a Windows share and contain CRLF line endings
gsub(/\r/,"", $0);
# Skip empty lines and comment lines starting with semicolon
if (NF && !match($0, /^[[:space:]]*;/))
{
print " " $0 ";";
}
}
END {
print " local: *;"
print "};";
}
```
Revert "Fix bracket expression matches a character at gawk" | ```awk
BEGIN {
print "V1.0 {";
print " global:";
}
{
# Remove the CR character in case the sources are mapped from
# a Windows share and contain CRLF line endings
gsub(/\r/,"", $0);
# Skip empty lines and comment lines starting with semicolon
if (NF && !match($0, /^[:space:]*;/))
{
print " " $0 ";";
}
}
END {
print " local: *;"
print "};";
}
``` |
9c921d0c-7c75-4229-a32e-4c29f95c5a2c | {
"language": "Awk"
} | ```awk
#!/bin/awk
#
# $Id$
{
if (NR == 1) {
print
}
else {
for (i = 1; i <= NF; i++) {
if ($i ~ /^include\// ||
$i ~ /^src\// ||
$i ~ /^obj\// ||
$i == "\\")
printf " " $i
}
print ""
}
}
```
Include header files whose path begins with ../ . | ```awk
#!/bin/awk
#
# $Id$
{
if (NR == 1) {
print
}
else {
for (i = 1; i <= NF; i++) {
if ($i ~ /^include\// ||
$i ~ /^src\// ||
$i ~ /^obj\// ||
$i ~ /^\.\.\// ||
$i == "\\")
printf " " $i
}
print ""
}
}
``` |
3d9936c0-79a4-4a7c-8e67-5d1161bc98b8 | {
"language": "Awk"
} | ```awk
BEGIN{
now = systime()
format = "%Y/%m/%d %H:%M:%S"
}
{
split($1, DATE, "/")
split($2, TIME, ":")
$1 = ""
$2 = ""
t = mktime(DATE[1] " " DATE[2] " " DATE[3] " " TIME[1] " " TIME[2] " " TIME[3])
if (delta == "") {
delta = now - t
}
print strftime(format, t + delta) $0
}
```
Fix an output formatting bug in the rewriter script. | ```awk
BEGIN{
now = systime()
format = "%Y/%m/%d %H:%M:%S"
}
{
split($1, DATE, "/")
split($2, TIME, ":")
t = mktime(DATE[1] " " DATE[2] " " DATE[3] " " TIME[1] " " TIME[2] " " TIME[3])
if (delta == "") {
delta = now - t
}
out = strftime(format, t + delta)
for (i = 3; i <= NF; i++) {
out = out OFS $i
}
print out
}
``` |
790f1b44-1fd1-4102-983e-3b92d71801ea | {
"language": "Awk"
} | ```awk
BEGIN{doit = 0}
{ if (doit) print $0 }
$0 == "%%EndSetup" { doit = 1 }
```
Fix awk script to work with cairo generated postscript | ```awk
BEGIN{doit = 0}
{ if (doit) print $0 }
$0 = /%%End.*Setup/ { doit = 1 }
``` |
188b7040-a661-405d-a2eb-ee8e915d4103 | {
"language": "Awk"
} | ```awk
#!/usr/bin/awk -f
BEGIN { FS = "," }
$1 == "pld" { p += $2 }
$1 == "val" { v += $2 }
{ "date -d "$3" +%B" | getline month
monthly[month][$1] += $2
categorically[$1][$4] += $2 }
END { print "Val spent "v"€"
print "PLD spent "p"€"
if ( p < v )
print "PLD owe "v - p"€ to val."
else if ( p > v )
print "Val owe "p - v"€ to PLD."
else
print "Accounts are balanced."
print ""
if ( verbose == 1 ) {
print "Here's the detail:"
print " Spendings per month:"
for ( month in monthly ) {
print " In "month":"
for ( who in monthly[month] ) {
print " "who" spent "monthly[month][who]"€."
}
}
print " Spendings by category:"
for ( who in categorically ) {
print " By "who":"
for ( category in categorically[who] ) {
print " "categorically[who][category]"€ in "category"."
}
}
}
}
```
Add year differentation into monthly report | ```awk
#!/usr/bin/awk -f
BEGIN { FS = "," }
$1 == "pld" { p += $2 }
$1 == "val" { v += $2 }
{ "date -d "$3" '+%B %Y'" | getline month_and_year
monthly[month_and_year][$1] += $2
categorically[$1][$4] += $2 }
END { print "Val spent "v"€"
print "PLD spent "p"€"
if ( p < v )
print "PLD owe "v - p"€ to val."
else if ( p > v )
print "Val owe "p - v"€ to PLD."
else
print "Accounts are balanced."
print ""
if ( verbose == 1 ) {
print "Here's the detail:"
print " Spendings per month:"
for ( month_and_year in monthly ) {
print " In "month_and_year":"
total_for_month = 0
for ( who in monthly[month_and_year] ) {
spent = monthly[month_and_year][who]
print " "who" spent "spent"€."
total_for_month += spent
}
print " Total: "total_for_month"€."
}
print " Spendings by category:"
for ( who in categorically ) {
print " By "who":"
for ( category in categorically[who] ) {
print " "categorically[who][category]"€ in "category"."
}
}
}
}
``` |
ba96f3fa-2d16-4c65-9932-7b79e2267b43 | {
"language": "Awk"
} | ```awk
#
# Parsing output of:
#
# hdfs dfs -du -s '/user/*'
#
function dbstr(s) {
if (s) { return "'" s "'" }
else { return "NULL" }
}
function dbi(i) {
if (i >= 0) { return i }
else { return "NULL" }
}
BEGIN {
FS="[ \t/]+"
print "INSERT INTO measure (name) VALUES ('quota');";
}
{
used=$1
user=$4
print "INSERT INTO quota (id_measure, user, used) VALUES (last_insert_id(), " dbstr(user) ", " dbi(used) ");"
}
```
Support also different version of Hadoop (=Fedora). | ```awk
#
# Parsing output of:
#
# hdfs dfs -du -s '/user/*'
#
function dbstr(s) {
if (s) { return "'" s "'" }
else { return "NULL" }
}
function dbi(i) {
if (i >= 0) { return i }
else { return "NULL" }
}
BEGIN {
FS="[ \t/]+"
print "INSERT INTO measure (name) VALUES ('quota');";
}
/^[0-9]+[ ]+[0-9]+[ ]+\/.*/ {
used=$1
user=$4
print "INSERT INTO quota (id_measure, user, used) VALUES (last_insert_id(), " dbstr(user) ", " dbi(used) ");"
}
/^[0-9]+[ ]+\/.*/ {
used=$1
user=$3
print "INSERT INTO quota (id_measure, user, used) VALUES (last_insert_id(), " dbstr(user) ", " dbi(used) ");"
}
``` |
f002b54c-70d0-4af8-9c51-09e47e0ffc5d | {
"language": "Awk"
} | ```awk
{
title = $0
if (match (title, /, The"$/)) {
sub (/^"/,"\"The ", title)
sub (/, The"$/,"\"", title)
}
printf ("echo ==\\> %3d: %s\n",NR,title) >> TITLES_SCRIPT
printf ("./getIMDbInfoFrom-titles.py %s\n",title) >> TITLES_SCRIPT
printf ("echo \n\n") >> TITLES_SCRIPT
printf ("echo ==\\> %3d: %s\n",NR,title) >> ID_SCRIPT
printf ("./getIMDb_IDsFrom-titles.py %s | head -7\n",title) >> ID_SCRIPT
printf ("echo \n\n") >> ID_SCRIPT
}
```
Add identifier KEY so we can see where we are in -v script | ```awk
{
title = $0
if (match (title, /, The"$/)) {
sub (/^"/,"\"The ", title)
sub (/, The"$/,"\"", title)
}
if (FILENAME ~ /Acorn/)
KEY = "A"
if (FILENAME ~ /BBox/)
KEY = "B"
if (FILENAME ~ /MHz/)
KEY = "M"
if (FILENAME ~ /Watched/)
KEY = "W"
printf ("echo ==\\> %sT %3d: %s\n", KEY, NR, title) >> TITLES_SCRIPT
printf ("./getIMDbInfoFrom-titles.py %s\n",title) >> TITLES_SCRIPT
printf ("echo \n\n") >> TITLES_SCRIPT
printf ("echo ==\\> %sI %3d: %s\n", KEY, NR, title) >> ID_SCRIPT
printf ("./getIMDb_IDsFrom-titles.py %s | head -7\n",title) >> ID_SCRIPT
printf ("echo \n\n") >> ID_SCRIPT
}
``` |
ad3728ab-710b-4c61-9dcf-bfc0e70c7945 | {
"language": "Awk"
} | ```awk
BEGIN {
session_count = 0;
FS="|"
OFS="|"
}
{
if ($3 ~ "[0-9]+") {
# See if the current line is already in the table
frame_file = destDir "/frames/Frame"$3".html"
session_line = ""
"grep -i \"" session_token "\" " frame_file | getline session_line
if (session_line == "" ) {
$6 = "{0}"
print $0
} else {
found = 0;
split(session_line, array, " ")
session = array[2]
for (i=0; i < session_count; i++) {
if (sessions[i] == session) {
found = 1
$6 = "{" i+1 "}"
print $0
break
}
}
if (found == 0) {
$6 = "{" session_count+1 "}"
sessions[session_count++] = session
print $0
s = sprintf("echo '%2d: new session in frame %4s: %s' >&2", session_count, $3, session)
system(s)
}
}
} else {
# Comment line, line starting with "#".
# Requires no processing, just print it
print $0
}
}
```
Add a close command to avoid too many files opened problems (encountered with large libpcap file) | ```awk
BEGIN {
session_count = 0;
FS="|"
OFS="|"
}
{
if ($3 ~ "[0-9]+") {
# See if the current line is already in the table
frame_file = destDir "/frames/Frame"$3".html"
session_line = ""
"grep -i \"" session_token "\" " frame_file | getline session_line
close(grep)
if (session_line == "" ) {
$6 = "{0}"
print $0
} else {
found = 0;
split(session_line, array, " ")
session = array[2]
for (i=0; i < session_count; i++) {
if (sessions[i] == session) {
found = 1
$6 = "{" i+1 "}"
print $0
break
}
}
if (found == 0) {
$6 = "{" session_count+1 "}"
sessions[session_count++] = session
print $0
s = sprintf("echo '%2d: new session in frame %4s: %s' >&2", session_count, $3, session)
system(s)
}
}
} else {
# Comment line, line starting with "#".
# Requires no processing, just print it
print $0
}
}
``` |
edd29c83-81d9-4eb7-936c-fcb5ef22b18d | {
"language": "Awk"
} | ```awk
###############################################################################
# BRLTTY - A background process providing access to the console screen (when in
# text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2006 by The BRLTTY Developers.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation. Please see the file COPYING for details.
#
# Web Page: http://mielke.cc/brltty/
#
# This software is maintained by Dave Mielke <[email protected]>.
###############################################################################
/#define[ \t]*BRLAPI_KEY_[A-Z_]+_MASK/ {
apiMask(substr($2, 12), $2, getDefineValue(), "")
next
}
/#define[ \t]*BRLAPI_KEY_[A-Z_]+_SHIFT/ {
apiShift(substr($2, 12), $2, getDefineValue(), "")
next
}
/#define[ \t]*BRLAPI_KEY_TYPE_/ {
apiType(substr($2, 17), $2, getDefineValue(), "")
next
}
/#define[ \t]*BRLAPI_KEY_SYM_/ {
apiKey(substr($2, 16), $2, getDefineValue(), "")
next
}
```
Define KEY_MAX for Python. (dm) | ```awk
###############################################################################
# BRLTTY - A background process providing access to the console screen (when in
# text mode) for a blind person using a refreshable braille display.
#
# Copyright (C) 1995-2006 by The BRLTTY Developers.
#
# BRLTTY comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation. Please see the file COPYING for details.
#
# Web Page: http://mielke.cc/brltty/
#
# This software is maintained by Dave Mielke <[email protected]>.
###############################################################################
/#define[ \t]*BRLAPI_KEY_MAX/ {
apiMask(substr($2, 12), $2, getDefineValue(), "")
next
}
/#define[ \t]*BRLAPI_KEY_[A-Z_]+_MASK/ {
apiMask(substr($2, 12), $2, getDefineValue(), "")
next
}
/#define[ \t]*BRLAPI_KEY_[A-Z_]+_SHIFT/ {
apiShift(substr($2, 12), $2, getDefineValue(), "")
next
}
/#define[ \t]*BRLAPI_KEY_TYPE_/ {
apiType(substr($2, 17), $2, getDefineValue(), "")
next
}
/#define[ \t]*BRLAPI_KEY_SYM_/ {
apiKey(substr($2, 16), $2, getDefineValue(), "")
next
}
``` |
309c52ad-827a-4e88-8591-c7209c7df675 | {
"language": "Awk"
} | ```awk
#!/usr/bin/awk -f
#
# Adds github compatible labels to level 1 and 2 markdown headings
# in underline style.
#
#
# Substitute github references with doxygen references.
#
/\(#[_a-z0-9-]*\)/ {
gsub(/\(#[_a-z0-9-]*\)/, "<__REF__&__REF__>")
gsub(/<__REF__\(#/, "(@ref ")
gsub(/\)__REF__>/, ")")
}
#
# If this line is underlining a heading, add a label to the previous
# line.
#
line && (/^===*$/ || /^---*$/) {
id = tolower(line)
gsub(/[^_a-z0-9]+/, "-", id)
line = line " {#" id "}"
}
#
# Print the previous line, after a label might have been added.
#
{print line}
#
# Remember this line when scanning the next one for underlining.
#
{line = $0}
#
# Print the last line.
#
END { print }
```
Use a file name prefix for generated labels | ```awk
#!/usr/bin/awk -f
#
# Adds github compatible labels to level 1 and 2 markdown headings
# in underline style.
#
#
# Get file name prefix for references.
#
filename != FILENAME {
filename = FILENAME
# strip path
"pwd" | getline path
path = path "/"
prefix = substr(filename, 1, length(path)) == path \
? substr(filename, length(path) + 1) \
: filename
sub(/\.[^.]*$/, "", prefix)
gsub(/[^_a-z0-9]+/, "-", prefix)
prefix = "md_" prefix "_"
}
#
# Substitute github references with doxygen references.
#
/\(#[_a-z0-9-]*\)/ {
gsub(/\(#[_a-z0-9-]*\)/, "<__REF__&__REF__>")
gsub(/<__REF__\(#/, "(@ref " prefix)
gsub(/\)__REF__>/, ")")
}
#
# If this line is underlining a heading, add a label to the previous
# line.
#
line && (/^===*$/ || /^---*$/) {
id = tolower(line)
gsub(/[^_a-z0-9]+/, "-", id)
line = line " {#" prefix id "}"
}
#
# Print the previous line, after a label might have been added.
#
{print line}
#
# Remember this line when scanning the next one for underlining.
#
{line = $0}
#
# Print the last line.
#
END { print }
``` |
5f719b07-7382-4d88-8a12-0c495f8f0f2c | {
"language": "Awk"
} | ```awk
BEGIN {
}
function extension(str){
n = split(str, parts, ".")
if (n == 1){
return "<NO EXTENSION>"
} else {
return parts[n]
}
}
$2 != "total" {
by_type[extension($2)] += $1
}
$2 ~ "CMakeLists.txt" {
#cmake should not count as text
by_type["txt"] -= $1
by_type["cmake"] += $1
}
$2 ~ "test" {
by_type[extension($2)] -= $1
by_type["TEST"] += $1
}
END {
# join up cpp types
by_type["cpp"] += by_type["hpp"]
delete by_type["hpp"]
#get rid of some filetypes I dont care about
delete by_type["gitignore"]
delete by_type["jpg"]
delete by_type["png"]
delete by_type["ttf"]
delete by_type["pdf"]
#print each extension, collect the total
total=0
for (x in by_type) {
if (by_type[x] > 0) {
total += by_type[x]
print (x, by_type[x])
}
}
print("Total:", total)
}
```
Fix an awk script that doesn't seem to be very portable | ```awk
BEGIN {
}
function getExtension(str){
n = split(str, parts, ".")
if (n == 1){
return "<NO EXTENSION>"
} else {
return parts[n]
}
}
$2 != "total" {
by_type[getExtension($2)] += $1
}
$2 ~ "CMakeLists.txt" {
#cmake should not count as text
by_type["txt"] -= $1
by_type["cmake"] += $1
}
$2 ~ "test" {
by_type[getExtension($2)] -= $1
by_type["TEST"] += $1
}
END {
# join up cpp types
by_type["cpp"] += by_type["hpp"]
delete by_type["hpp"]
#get rid of some filetypes I dont care about
delete by_type["gitignore"]
delete by_type["jpg"]
delete by_type["png"]
delete by_type["ttf"]
delete by_type["pdf"]
#print each getExtension, collect the total
total=0
for (x in by_type) {
if (by_type[x] > 0) {
total += by_type[x]
print (x, by_type[x])
}
}
print("Total:", total)
}
``` |
e2a3fa41-9072-4d9c-b18f-0a26ffdfec16 | {
"language": "Awk"
} | ```awk
{ content = $1 ~ /^(content|skin|locale)$/ }
content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF }
content {
sub(/^\.\./, "", $NF);
$NF = "jar:chrome/" name ".jar!" $NF
}
{
sub("^\\.\\./liberator/", "", $NF)
print
}
```
Fix the modules path in the xpi chrome.manifests | ```awk
{ content = $1 ~ /^(content|skin|locale)$/ }
content && $NF ~ /^[a-z]/ { $NF = "/" name "/" $NF }
content {
sub(/^\.\./, "", $NF);
$NF = "jar:chrome/" name ".jar!" $NF
}
{
sub("^\\.\\./common/", "", $NF)
print
}
``` |
09e73d2a-e5e6-4c29-8fa4-9bd7c7b0b88a | {
"language": "Awk"
} | ```awk
# Generate MHz_TV_Shows_minutes.csv by processing SHORT_SPREADSHEET to figure
# average episode length
#
BEGIN {
FS = "\t"
}
/^Title/ {
printf ("%s\t%s\t%s\t%s\tAvg Len\t%s\t%s\t%s\t%s\t%s\n",
$1,$2,$3,$4,$5,$6,$7,$8,$9)
}
/=HYPERLINK/ {
dur=$4
sub (/h/,"",dur)
sub (/m/,"",dur)
split (dur,fld," ")
eplen = (fld[1]*60+fld[2])/$3
printf ("%s\t%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\n",
$1,$2,$3,$4,eplen,$5,$6,$7,$8,$9)
}
```
Print last two lines in Avg | ```awk
# Generate MHz_TV_Shows_minutes.csv by processing SHORT_SPREADSHEET to figure
# average episode length
#
BEGIN {
FS = "\t"
}
/^Title/ {
printf ("%s\t%s\t%s\t%s\tAvg Len\t%s\t%s\t%s\t%s\t%s\n",
$1,$2,$3,$4,$5,$6,$7,$8,$9)
}
/=HYPERLINK/ {
dur=$4
sub (/h/,"",dur)
sub (/m/,"",dur)
split (dur,fld," ")
eplen = (fld[1]*60+fld[2])/$3
printf ("%s\t%s\t%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\n",
$1,$2,$3,$4,eplen,$5,$6,$7,$8,$9)
}
/^Non-blank values/ || /^Total seasons & episodes/ { print }
``` |
a6e74fff-1dfd-46eb-9d52-98702a7beea9 | {
"language": "Awk"
} | ```awk
BEGIN {
print "V1.0 {";
print " global:";
}
{
# Remove the CR character in case the sources are mapped from
# a Windows share and contain CRLF line endings
gsub(/\r/,"", $0);
# Skip empty lines and comment lines starting with semicolon
if (NF && !match($0, /^[:space:]*;/))
{
print " " $0 ";";
}
}
END {
print " local: *;"
print "};";
}
```
Handle mscorwks_unixexports.src with better regexp operator for compatibility | ```awk
BEGIN {
print "V1.0 {";
print " global:";
}
{
# Remove the CR character in case the sources are mapped from
# a Windows share and contain CRLF line endings
gsub(/\r/,"", $0);
# Skip empty lines and comment lines starting with semicolon
if (NF && !match($0, /^[ \t]*;/))
{
print " " $0 ";";
}
}
END {
print " local: *;"
print "};";
}
``` |
6ca47e06-0b81-4f1c-b12e-75efb32ce40e | {
"language": "Awk"
} | ```awk
#
# Converts the output of 'nm' into a C source containing an array of symbols
# that correspond to functions (t and T in terms of 'nm').
#
# Usage:
# nm -n image | awk -f nm2c.awk
#
# Date: Aug 28, 2012
# Author: Eldar Abusalimov
#
BEGIN {
print "/* Auto-generated file. Do not edit. */";
print "";
print "#include <debug/symbol.h>";
print "#include <stddef.h>";
print "";
print "const struct symbol __symbol_table[] = {";
}
/^[0-9a-fA-F]* [tT]/ {
printf "\t{ (void *) 0x%s, \"%s\" },\n", $1, $3;
}
END {
print "};";
print "const size_t __symbol_table_size =";
print "\tsizeof(__symbol_table) / sizeof(__symbol_table[0]);";
print "";
}
```
Fix for symbol table demangled names with spaces | ```awk
#
# Converts the output of 'nm' into a C source containing an array of symbols
# that correspond to functions (t and T in terms of 'nm').
#
# Usage:
# nm -n image | awk -f nm2c.awk
#
# Date: Aug 28, 2012
# Author: Eldar Abusalimov
#
BEGIN {
print "/* Auto-generated file. Do not edit. */";
print "";
print "#include <debug/symbol.h>";
print "#include <stddef.h>";
print "";
print "const struct symbol __symbol_table[] = {";
}
/^[0-9a-fA-F]* [tT]/ {
split($0,a," [tT] ");
printf "\t{ (void *) 0x%s, \"%s\" },\n", $1, a[2];
}
END {
print "};";
print "const size_t __symbol_table_size =";
print "\tsizeof(__symbol_table) / sizeof(__symbol_table[0]);";
print "";
}
``` |
09a301cb-10b0-43d0-bd31-02527002156e | {
"language": "Awk"
} | ```awk
BEGIN {
FS="\n"
OFS=""
ORS="\n"
print "#!/bin/sh"
print " "
}
# blank lines
/^$/ { next }
# record header
$1 ~ /^\*\*\*\*/ {
next
}
# summary field
$1 ~ /^[ ]*summary\:/ {
gsub(/\r/,"");
idx = match($1, /summary\:(.*)/)
print "SUMMARY=\"" substr($1, idx + 9) "\""
next
}
# startdate field
$1 ~ /^[ ]*startdate\: / {
match($1, /startdate\: /)
print "STARTDATE=\"`date -d '" substr($1, RSTART + RLENGTH) "-000' '+%a %e %b %R'`\""
next
}
# vcalendar start tag
$1 ~ /^[ ]*calendardata\: / {
gsub(/\r/,"");
match($1, /calendardata\: /)
print "echo \"" substr($1, RSTART + RLENGTH) "\" >event.ics"
next
}
# vcalendar end tag
$1 ~ /^END\:VCALENDAR/ {
gsub(/\r/,"");
print "echo \"" $1 "\" >>event.ics"
print "mpack -s \"$SUMMARY - $STARTDATE\" event.ics $1"
print ""
next
}
# vcalendar body
{
gsub(/\r/,"");
print "echo \"" $0 "\" >> event.ics"
}
```
Improve shell script (thx 'Barmic') | ```awk
BEGIN {
FS="\n";
OFS="";
ORS="\n";
print "#!/bin/sh";
print "#";
}
# blank lines
/^$/ {
next;
}
# record header
$1 ~ /^\*\*\*\*/ {
next;
}
# summary field
$1 ~ /^[ ]*summary\:/ {
gsub(/\r/,"");
idx = match($1, /summary\:(.*)/);
print "SUMMARY=\"" substr($1, idx + 9) "\"";
next;
}
# startdate field
$1 ~ /^[ ]*startdate\: / {
match($1, /startdate\: /);
print "STARTDATE=\"`date -d '" substr($1, RSTART + RLENGTH) "-000' '+%a %e %b %R'`\"";
next;
}
# vcalendar start tag
$1 ~ /^[ ]*calendardata\: / {
gsub(/\r/,"");
match($1, /calendardata\: /);
print "ICS=$(mktemp --suffix=.ics)";
print "cat > \"${ICS}\" <<EOF";
print substr($1, RSTART + RLENGTH);
next;
}
# vcalendar end tag
$1 ~ /^END\:VCALENDAR/ {
gsub(/\r/,"");
print $1;
print "EOF";
print "mpack -s \"$SUMMARY - $STARTDATE\" \"${ICS}\" $1";
print "#";
next;
}
# vcalendar body
{
gsub(/\r/,"");
print $0;
}
``` |
377eb37c-2aa1-4d8d-be7c-9154c5e4e0a2 | {
"language": "Awk"
} | ```awk
#!/usr/bin/awk -f
BEGIN {
FS = OFS = "\t";
}
{
len = split($3, words, ", ");
if (length(N) > 0 && len >= N) next;
for (i = 1; i <= len - 1; i++) {
for (j = i + 1; j <= len; j++) {
print words[i], words[j], ORS, words[j], words[i] | "sort --parallel=$(nproc) -us";
}
}
}
```
Fix the pair generation and also speed up the sorting | ```awk
#!/usr/bin/awk -f
BEGIN {
FS = "\t";
OFS = "";
}
{
len = split($3, words, ", ");
if (length(N) > 0 && len >= N) next;
for (i = 1; i <= len - 1; i++) {
for (j = i + 1; j <= len; j++) {
print words[i], FS, words[j], ORS, words[j], FS, words[i] | "sort --parallel=$(nproc) -S1G -us";
}
}
}
``` |
85db9573-0fde-4c33-8834-653cfcc746c4 | {
"language": "Awk"
} | ```awk
{
if (1==NR)
{
startTimestamp = substr($1, 2, length($1) - 2)
printf(";$FILEVERSION=1.3\n")
printf(";$STARTTIME=%u.%u\n", mktime(strftime("%Y %m %d 0 0 0", startTimestamp)) / 86400 + 25569, \
10000000000 / 86400 * (mktime(strftime("%Y %m %d %H %M %S", startTimestamp)) - mktime(strftime("%Y %m %d 0 0 0", startTimestamp))))
}
printf("%u) %.3f 1 Rx %s - %s", NR, (substr($1, 2, length($1) - 2) - startTimestamp) * 1000, $3, substr($4, 2, length($4) - 2))
if (5<=NF)
{
for(i=5;i<=NF;i++)
{
printf " "$i
}
}
printf "\n"
}
```
Handle cases where system time is adjusted backwards (e.g. by NTP). | ```awk
{
if (1==NR)
{
startTimestamp = substr($1, 2, length($1) - 2)
printf(";$FILEVERSION=1.3\n")
printf(";$STARTTIME=%u.%u\n", mktime(strftime("%Y %m %d 0 0 0", startTimestamp)) / 86400 + 25569, \
10000000000 / 86400 * (mktime(strftime("%Y %m %d %H %M %S", startTimestamp)) - mktime(strftime("%Y %m %d 0 0 0", startTimestamp))))
currentTimeOffset = 0.0
}
else
{
previousTimeOffset = currentTimeOffset
currentTimestamp = substr($1, 2, length($1) - 2)
currentTimeOffset = currentTimestamp - startTimestamp
if (currentTimeOffset < 0)
{
startTimestamp = currentTimestamp + currentTimeOffset
currentTimeOffset = previousTimeOffset
}
}
printf("%u) %.3f 1 Rx %s - %s", NR, currentTimeOffset * 1000, $3, substr($4, 2, length($4) - 2))
if (5<=NF)
{
for(i=5;i<=NF;i++)
{
printf " "$i
}
}
printf "\n"
}
``` |
e7009a76-320a-4ca2-b687-776f5a22aced | {
"language": "Awk"
} | ```awk
#!/usr/bin/awk
#
# Patch the generated wrapper Swift code to handle special cases
#
BEGIN { etpInit = 0 }
/public convenience init.T: ErrorTypeProtocol./ {
etpInit = 1
print " /// Convenience copy constructor, creating a unique copy"
print " /// of the passed in Error. Needs to be freed using free()"
print " /// (automatically done in deinit if you use ErrorType)."
}
/self.init.other.ptr./ {
if (etpInit) {
print " self.init(g_error_copy(other.ptr))"
etpInit = 0
next
}
}
/no reference counting for GError, cannot ref/ { next }
/no reference counting for GError, cannot unref/ {
print " g_error_free(error_ptr)"
next
}
/ -> GIConv {/, /^}/ {
sub(/GIConv {/,"GIConv? {")
sub(/return rv/,"return rv == unsafeBitCast(-1, to: GIConv.self) ? nil : rv")
}
// { print }
```
Mark CVaListPointer array generators as unavailable on Linux | ```awk
#!/usr/bin/awk
#
# Patch the generated wrapper Swift code to handle special cases
#
BEGIN { etpInit = 0 ; vaptrptr = 0 }
/public convenience init.T: ErrorTypeProtocol./ {
etpInit = 1
print " /// Convenience copy constructor, creating a unique copy"
print " /// of the passed in Error. Needs to be freed using free()"
print " /// (automatically done in deinit if you use ErrorType)."
}
/self.init.other.ptr./ {
if (etpInit) {
print " self.init(g_error_copy(other.ptr))"
etpInit = 0
next
}
}
/no reference counting for GError, cannot ref/ { next }
/no reference counting for GError, cannot unref/ {
print " g_error_free(error_ptr)"
next
}
/ -> GIConv {/, /^}/ {
sub(/GIConv {/,"GIConv? {")
sub(/return rv/,"return rv == unsafeBitCast(-1, to: GIConv.self) ? nil : rv")
}
/UnsafeMutablePointer.CVaListPointer/ {
vaptrptr = 1
print "#if !os(Linux)"
}
/^$/ {
if (vaptrptr) {
print "#endif"
vaptrptr = 0
}
}
/\/\/\// {
if (vaptrptr) {
print "#endif"
vaptrptr = 0
}
}
// { print }
``` |
e27a5cd7-b054-4e99-9825-2a9dc29f0764 | {
"language": "Awk"
} | ```awk
# $Id: ndcedit.awk,v 1.4 1997/02/22 16:08:19 peter Exp $
NR == 3 {
print "#"
print "# This file is generated automatically, do not edit it here!"
print "# Please change src/usr.sbin/ndc/ndcedit.awk instead"
print "#"
print ""
print "# If there is a global system configuration file, suck it in."
print "if [ -f /etc/rc.conf ]; then"
print "\t. /etc/rc.conf"
print "fi\n"
}
{
if ($1 == "named") {
printf "\t\t# $namedflags is imported from /etc/rc.conf\n"
printf "\t\tif [ \"X${named_flags}\" != X\"NO\" ]; then\n"
printf "\t\t\tnamed ${named_flags} && {\n"
getline
printf "\t%s\n", $0
getline
printf "\t%s\n", $0
getline
printf "\t%s\n", $0
printf "\t\tfi\n"
} else {
if (/PATH=/) {
gsub(":/usr/ucb:", ":", $0);
if (!/export/) {
$0=$0"\nexport PATH";
}
}
print;
}
}
```
Check named_enable rather than just named_flags. PR: 3893 (sort of) | ```awk
# $Id: ndcedit.awk,v 1.5 1997/05/27 07:19:57 jkh Exp $
NR == 3 {
print "#"
print "# This file is generated automatically, do not edit it here!"
print "# Please change src/usr.sbin/ndc/ndcedit.awk instead"
print "#"
print ""
print "# If there is a global system configuration file, suck it in."
print "if [ -f /etc/rc.conf ]; then"
print "\t. /etc/rc.conf"
print "fi\n"
}
{
if ($1 == "named") {
printf "\t\t# $named_flags is imported from /etc/rc.conf\n"
printf "\t\tif [ \"X${named_enable}\" = X\"YES\" ]; then\n"
printf "\t\t\tnamed ${named_flags} && {\n"
getline
printf "\t%s\n", $0
getline
printf "\t%s\n", $0
getline
printf "\t%s\n", $0
printf "\t\tfi\n"
} else {
if (/PATH=/) {
gsub(":/usr/ucb:", ":", $0);
if (!/export/) {
$0=$0"\nexport PATH";
}
}
print;
}
}
``` |
7e4fb15e-9386-4fb5-85a7-ef1e830127bd | {
"language": "Awk"
} | ```awk
BEGIN {
FS = "\""
}
/\/us\/movie\// {
numMovies += 1
shortURL = $6
printf ("%s \"https://www.britbox.com%s\"", trailingComma, shortURL) >> EPISODES_JSON_FILE
trailingComma = ",\n"
}
/\/us\/show\// {
numShows += 1
shortURL = $6
printf ("%s \"https://www.britbox.com%s\"", trailingComma, shortURL) >> EPISODES_JSON_FILE
printf ("%s \"https://www.britbox.com%s\"", trailingComma, shortURL) >> SEASONS_JSON_FILE
trailingComma = ",\n"
}
END {
print "" >> EPISODES_JSON_FILE
print "" >> SEASONS_JSON_FILE
print "==> Found " numMovies " movies"
print "==> Found " numShows " shows"
}
```
Fix extra comma in json file | ```awk
BEGIN {
FS = "\""
}
/\/us\/movie\// {
numMovies += 1
shortURL = $6
printf ("%s \"https://www.britbox.com%s\"", trailingEpisodesComma, shortURL) \
>> EPISODES_JSON_FILE
trailingEpisodesComma = ",\n"
}
/\/us\/show\// {
numShows += 1
shortURL = $6
printf ("%s \"https://www.britbox.com%s\"", trailingEpisodesComma, shortURL) \
>> EPISODES_JSON_FILE
trailingEpisodesComma = ",\n"
printf ("%s \"https://www.britbox.com%s\"", trailingSeasonsComma, shortURL) \
>> SEASONS_JSON_FILE
trailingSeasonsComma = ",\n"
}
END {
print "" >> EPISODES_JSON_FILE
print "" >> SEASONS_JSON_FILE
print "==> Found " numMovies " movies"
print "==> Found " numShows " shows"
}
``` |
1869ffd9-c187-4bc5-8fa7-77d12908a355 | {
"language": "Awk"
} | ```awk
```
Add script for generating vendor header include lines | ```awk
# Usage: awk -f <this_script> vendor/MKxxxx.h vendor/MKxxyy.h vendor/MKzzz.h ...
/Processor[s]?:/ {
i=0;
if (FNR == NR) {
printf "#if";
} else {
printf "#elif";
}
while(match($0, /MK.*/)) {
if (i>0) {
printf " || \\\n ";
}
printf " defined(CPU_MODEL_%s)", substr($0, RSTART, RLENGTH);
getline;
i++;
}
printf("\n#include \"%s\"\n", FILENAME);
nextfile;
}
END {
print "#endif"
}
``` |
6f7b1372-556a-48d3-978d-17786ab56705 | {
"language": "Awk"
} | ```awk
```
Add new script for gln testing report | ```awk
#!/usr/bin/awk -f
# cat *.tdb | tdbout -t publisher,plugin,publisher:info[tester],status
BEGIN {
FS="\t"
pn = 0
}
{
nn = split($2,na,/\./)
lp2 = na[nn]
if (!(($1,lp2) in b)) {
p[pn] = $1
n[pn] = lp2
# n[pn] = $2
r[pn] = $3
pn++
}
b[$1,lp2]++
c[$1,lp2,$4]++
x[$4]++
tt++
}
END {
s[0] = "expected"
s[1] = "exists"
s[2] = "manifest"
s[3] = "wanted"
s[4] = "crawling"
s[5] = "testing"
s[6] = "notReady"
s[7] = "released"
s[8] = "down"
s[9] = "superseded"
s[10] = "zapped"
sn = 11
sc[0] = "expe"
sc[1] = "exis"
sc[2] = "mani"
sc[3] = "want"
sc[4] = "craw"
sc[5] = "test"
sc[6] = "notR"
sc[7] = "rele"
sc[8] = "down"
sc[9] = "supe"
sc[10] = "zapp"
scn = 11
#print out header
printf "Publisher\tPlugin\tT\tTotal"
for (j = 0 ; j < scn ; j++) {
if (x[s[j]] > 0) {
printf "\t%s", sc[j]
}
}
printf "\n"
#print out publisher, plugin, tester, total aus
for (i = 0 ; i < pn ; i++) {
printf "%s\t%s\t%s\t%d", p[i], n[i], r[i], b[p[i],n[i]]
for (j = 0 ; j < sn ; j++) {
if (x[s[j]] > 0){
if (c[p[i],n[i],s[j]] == 0) {
printf "\t.."
} else {
printf "\t%d", c[p[i],n[i],s[j]]
}
}
}
printf "\n"
}
#print out bottom line sums
printf "Publisher\tPlugin\tT\t%d", tt
for (j = 0 ; j < sn ; j++) {
if (x[s[j]] > 0) {
printf "\t%d", x[s[j]]
}
}
printf "\n"
}
``` |
5134effe-011c-4594-a064-8dd5a301bfd8 | {
"language": "Awk"
} | ```awk
```
Add AWK script to generate a frequency table from a column of numbers | ```awk
#!/usr/bin/env awk -f
#
# Generates a frequency table.
#
# Usage: frequency_table
#
# Input:
# - a column of numbers
#
# Output:
# - frequency table
{
total += 1
table[$1] += 1
}
END {
for (v in table) {
count = table[v]
print v OFS count OFS count/total
}
}
``` |
f1c6e70a-4f1e-4b97-b454-8cdd58109958 | {
"language": "Awk"
} | ```awk
```
Add Tobias Waldekranz's awesome little AWK script | ```awk
# Calculate network address from IP and prefix len
# Tobias Waldekranz, 2017
#
# $ echo "192.168.2.232/24" | awk -f ipcalc.awk
# 192.168.2.0/24
#
# $ echo "192.168.2.232.24" | awk -f ipcalc.awk
# 192.168.2.0/24
#
# $ echo "192.168.2.232 24" | awk -f ipcalc.awk
# 192.168.2.0/24
#
BEGIN { FS="[. /]" }
{
ip = lshift($1, 24) + lshift($2, 16) + lshift($3, 8) + $4;
net = lshift(rshift(ip, 32 - $5), 32 - $5);
printf("%d.%d.%d.%d/%d\n",
and(rshift(net, 24), 0xff),
and(rshift(net, 16), 0xff),
and(rshift(net, 8), 0xff),
and(net, 0xff), $5);
}
``` |
4e1c0134-916f-469c-979d-191514f2803e | {
"language": "Awk"
} | ```awk
```
Add an awk script used in one-vs-the-rest classification example. | ```awk
BEGIN{ FS="\t"; OFS="\t"; }
{
possible_labels=$1;
rowid=$2;
label=$3;
features=$4;
label_count = split(possible_labels, label_array, ",");
for(i = 1; i <= label_count; i++) {
if (label_array[i] == label)
print rowid, label, 1, features;
else
print rowid, label_array[i], -1, features;
}
}
END{}
``` |
5e960284-6300-43f9-844a-8b6e52036765 | {
"language": "Awk"
} | ```awk
```
Add script to convert old submission format to new format. | ```awk
#!/usr/bin/env awk -f
{
for (i = 1; i <= NF; i++) {
if (i == 3) printf "-1 ";
printf $i" "
}
printf "\n"
}``` |
bf88c069-cbfc-4698-a2f8-5d2367e87858 | {
"language": "Awk"
} | ```awk
```
Add crosscheck of EPISODES with SEASONS | ```awk
# WebScraper has problems getting incomplete data.
#
# Crosscheck the info in EPISODES with the info in SEASONS. Count up episodes
# and compare with the number of episodes listed in the seasons file.
# For now these seem more likely a problem in scraping SEASONS than EPISODES
# so it could be these are false positives in generating spreadsheets.
# Problems listed in BBox_anomalies files are more likely to be real.
# INVOCATION
# awk -f verifyBBoxInfoFrom-webscraper.awk BBox_episodeInfo-180421.123042.txt
/ movie / {
title = $3
numEpisodes = $5
if (numEpisodes == 0)
print
}
/ show / {
numShows += 1
showTitle[numShows] = $3
shouldHave[numShows] = $5
doesHave[numShows] = 0
if (numEpisodes == 0)
print
}
/^ / {
epis = NF-1
if ($epis !~ /^[[:digit:]]*$/)
print "==> Bad input line " NR "\n" $0
else
doesHave[numShows] += $epis
}
END {
print ""
for ( i = 1; i <= numShows; i++ ) {
if (shouldHave[i] != doesHave[i]) {
print "==> show "showTitle[i] " has " doesHave[i] " instead of " \
shouldHave[i] " episodes."
}
}
}
``` |
77003028-fe7f-40f8-8e3a-e35965496fdd | {
"language": "Awk"
} | ```awk
```
Add parser for Z3's get-model output. | ```awk
#!/usr/bin/gawk -f
BEGIN{
bees="";
}
/^[ ]+\(define-fun.*Int$/{
bees = $2;
}
/^[ ]+[0-9]+\)/{
match ($0, /^[ ]+([0-9]+)\)/, arr)
print bees " " arr[1];
}
``` |
1a2c865b-d626-4356-8743-e36f518c58a1 | {
"language": "Awk"
} | ```awk
```
Add awk solution to problem 16 | ```awk
#!/usr/bin/awk -f
{
protein = ""
flag = 0 # Get rid of line with label
while (("curl -Ls http://www.uniprot.org/uniprot/"$1".fasta" | getline prot_line) > 0) {
if (flag)
# Append line to protein
protein = protein prot_line
else
# We're on the first line - ignore label and set flag
flag = 1
}
first = 1 # Print label only once
startidx = 1
do {
where = match(substr(protein, startidx), /N[^P][ST][^P]/)
if (where != 0) {
if (first) {
# Print label, start location string
print $0
loc_string = where + startidx - 1
# Reset flag
first = 0
}
else {
# Append to location string
loc_string = loc_string " " where + startidx - 1
}
# Update offset: start one after start of last match
startidx += where
}
} while (where != 0)
# Did we find something?
if (loc_string)
print loc_string
}
``` |
aa5542a8-427d-4fcd-8d7a-dccb1ce97a94 | {
"language": "Awk"
} | ```awk
```
Add a crosscheck for the SEASONS_SORTED_FILE | ```awk
# Crosscheck the number of episodes of each show found by counting them (grep -c)
# in EPISODES_SORTED_FILE versus the number added up from SEASONS_SORTED_FILE
# Both numbers are found by processing a checkEpisodeInfo file
#
# For now these seem more likely a problem in scraping SEASONS_SORTED_FILE than EPISODES_SORTED_FILE
# so it could be these are false positives in generating spreadsheets. The case is stronger for
# problems listed in checkBBox_anomalies files.
# INVOCATION:
# awk -f crosscheckInfo.awk checkEpisodeInfo-180415.185805.txt
/ movie / {
title = $3
numEpisodes = $5
if (numEpisodes == 0)
print
}
/ show / {
numShows += 1
showTitle[numShows] = $3
shouldHave[numShows] = $5
doesHave[numShows] = 0
if (numEpisodes == 0)
print
}
/^ / {
epis = NF-1
if ($epis !~ /^[[:digit:]]*$/)
print "==> Bad input line " NR "\n" $0
else
doesHave[numShows] += $epis
}
END {
for ( i = 1; i <= numShows; i++ ) {
if (shouldHave[i] != doesHave[i]) {
print "==> show "showTitle[i] " has " doesHave[i] " instead of " \
shouldHave[i] " episodes."
}
}
}
``` |
671d2183-6b5c-4c31-ad47-e2e0b31e3673 | {
"language": "Awk"
} | ```awk
```
Add AWK script to merge comma-terminated lines | ```awk
#!/usr/bin/awk -f
#
# AWK script to join multiple lines if the preceeding line ends with a comma (,).
#
# For example:
#
# 1,
# 2,
# 3
#
# Turns into:
#
# 1, 2, 3
#
/,$/ {
ORS=""
print $0
do {
getline
print $0
} while ($0 ~ /,$/)
ORS="\n"
print ""
}
``` |
e1437fa7-af32-40f1-9084-6035ed3f699d | {
"language": "Awk"
} | ```awk
```
Add Netflix specific link generator | ```awk
# Helper for converting Netflix "viewing activity" into hyperlinks
#
# <a href="/title/80988960" data-reactid="68">Death in Paradise: Season 6: "Man Overboard, Part 2"
# <a href="/title/80170369" data-reactid="124">Ugly Delicious: Season 1: "Pizza"
# <a href="/title/80190361" data-reactid="100">Hinterland: Season 3: "Episode 2"
# INVOCATION:
# Browse to https://www.netflix.com/viewingactivity
# Save as 'Page Source'
# awk -f generateLinksFrom-NetflixActivityPage.awk ~/Downloads/Netflix.html
BEGIN {
RS="\<"
# print 10 records unless overridden with "-v maxRecordsToPrint=<n>"
if (maxRecordsToPrint == "") maxRecordsToPrint = 10
}
/div class="col date nowrap"/ {
split ($0,fld,">")
date = fld[2]
}
/a href="\/title\// {
split ($0,fld,">")
title = fld[2]
split ($0,fld,"\"")
URL = fld[2]
gsub (/"/,"",title)
printf ("=HYPERLINK(\"https://www.netflix.com/%s\";\"%s\")\t%s\tNetflix Streaming\n",\
URL,title,date)
recordsPrinted += 1
if (recordsPrinted >= maxRecordsToPrint)
exit
}
``` |
b27ae15e-c07c-4156-8a05-8f7689e7b4da | {
"language": "Awk"
} | ```awk
```
Add AWK script to compute the corrected sample standard deviation | ```awk
#!/usr/bin/env awk -f
#
# Computes the corrected sample standard deviation.
#
# Usage: stdev
#
# Input:
# - a column of numbers
#
# Output:
# - corrected sample standard deviation
#
# Notes:
# - Uses [Welford's method][1].
#
# [1]: https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Online_algorithm
BEGIN {
delta = 0
mean = 0
M2 = 0
N = 0
}
{
N += 1
delta = $1 - mean
mean += delta / N
M2 += delta * ($1 - mu)
}
END {
if (N < 2) {
print 0
} else {
print sqrt(M2 / (N-1))
}
}
``` |
2599a817-d637-49b7-9a3b-2977f832d319 | {
"language": "Awk"
} | ```awk
```
Make script to process top level BritBox shows | ```awk
BEGIN {
FS="\t"
print "Sortkey\tTitle\tSeasons\tDuration\tYear\tRating\tDescription"
}
# if needed for debugging record placment, replace "/nosuchrecord/" below
/nosuchrecord/ {
print ""
print NR " - " $0
for ( i = 1; i <= NF; i++ ) {
print "field " i " = " $i
}
}
{
for ( i = 1; i <= NF; i++ ) {
if ($i == "null")
$i = ""
}
}
/\/us\/movie\/|\/us\/show\//{
URL = $3
showTitle = $4
Year = $5
NumSeasons = $6
Duration = $7
Rating = $8
Description = $9
sub (/ Season[s]/,"",NumSeasons)
sub( / min/,"",Duration)
# Convert duration from minutes to HMS
secs = 0
mins = Duration % 60
hrs = int(Duration / 60)
HMS = sprintf ("%02d:%02d:%02d", hrs, mins, secs)
# Titles starting with "The" should not sort based on "The"
if (match (showTitle, /^The /)) {
showTitle = substr(showTitle, 5) ", The"
}
}
/\/us\/movie\// {
# Extract movie sortkey from URL
nflds = split (URL,fld,"_")
if (URL ~ /_[[:digit:]]*$/) {
sortkey = sprintf ("M%05d", fld[nflds])
printf \
("%s %s - mv\t=HYPERLINK(\"https://www.britbox.com%s\";\"%s, %s, %s\"\)\t\t%s\t%s\t%s\t%s\n", \
showTitle, sortkey, URL, showTitle, sortkey, \
Title, HMS, Year, Rating, Description)
}
next
}
/\/us\/show\// {
# Extract show sortkey from URL
nflds = split (URL,fld,"_")
if (URL ~ /_[[:digit:]]*$/) {
sortkey = sprintf ("S%05d", fld[nflds])
printf \
("%s %s - sh\t=HYPERLINK(\"https://www.britbox.com%s\";\"%s, %s, %s\"\)\t\t%s\t%s\t%s\t%s\n", \
showTitle, sortkey, URL, showTitle, sortkey, \
Title, HMS, Year, Rating, Description)
}
next
}
``` |
21073d71-52bd-447c-90ef-f5284ec497cb | {
"language": "Awk"
} | ```awk
```
Create helper for Netflix activity | ```awk
# Helper for converting Netflix "viewing activity" into hyperlinks
#
# Since there is no way to paste an embedded hyperlink into a text filei,
# paste the link and the title on two consecutive lines, e.g.
#
# https://www.netflix.com/title/80174814
# Borderliner: Season 1: "Milla’s Future"
# https://www.netflix.com/title/80203122
# Luxury Travel Show: Season 1: "Chiang Mai & Eze"
# https://www.netflix.com/title/80217826
# Kavin Jay: Everybody Calm Down!
/^https:/ {
link = $0
if ((getline title) > 0) {
gsub (/"/,"\"\"",title)
printf ("=HYPERLINK(\"%s\";\"%s\")\n",link,title)
}
}
``` |
91f10bc3-4d48-4808-b34a-4f1043ee9b69 | {
"language": "Awk"
} | ```awk
```
Add debugging tool which prints WebScraper field names | ```awk
# Print field numbers and field names from a WebScraper csv file saved in tsv format
# INVOCATION:
# awk -f printFieldNamesFrom-webscraper.awk -v maxRecordsToPrint=5 BritBoxSeasons-test-tabs.csv
BEGIN {
FS="\t"
# print 3 records unless overridden with "-v maxRecordsToPrint=<n>"
if (maxRecordsToPrint == "") maxRecordsToPrint = 3
}
NR <= maxRecordsToPrint {
print "Record " NR
for ( i = 1; i <= NF; i++ ) {
print i " - " $i
}
print ""
}
``` |
922cd6e6-1ddc-4eb2-a797-d303d0bd308d | {
"language": "Awk"
} | ```awk
```
Add the unified pair generation script | ```awk
#!/usr/bin/awk -f
BEGIN{
FS = OFS = "\t";
}
{
split($3, words, ", ");
for (i = 1; i <= length(words) - 1; i++) {
for (j = i + 1; j <= length(words); j++) {
print words[i], words[j];
print words[j], words[i];
}
}
}
``` |
bc4a0fbd-88a1-4994-b3df-712383fdea59 | {
"language": "Awk"
} | ```awk
```
Add only unique reads for paired end filter | ```awk
BEGIN {
OFS="\t";
lastid="";
id_counts=0;
}
{
if ( $1 ~ /^@/ )
{
# headers go straight through
print $0;
next;
}
if (lastid == "") {
lastid=$1;
r1["read"] = $0;
r1["chr"] = $3;
r1["tags"] = "";
for(i=12;i<NF;i++) { r1["tags"]=r1["tags"] $i " ";}
r1["tags"]=r1["tags"] $i;
next;
}
if ( lastid == $1 ) {
id_counts++;
if ( id_counts == 2 ) {
r2["read"] = $0;
r2["chr"] = $3;
r2["tags"] = "";
for(i=12;i<NF;i++) { r2["tags"]=r2["tags"] $i " ";}
r2["tags"]=r2["tags"] $i;
}
} else if ( lastid != $1 ) {
if ( 2 == id_counts ) {
# two matching ends of a pair, should we include them?
if ( (r1["chr"] ~ /chr([[:digit:]]+|[XY]|MT)/) && (r2["chr"] ~ /chr([[:digit:]]+|[XY]|MT)/) &&
(r1["tags"] ~ /XT:A:U/) && (r2["tags"] ~ /XT:A:U/) ) {
print r1["read"];
print r2["read"];
}
}
id_counts=1;
lastid=$1;
r1["read"] = $0;
r1["chr"] = $3;
r1["tags"]="";
for(i=12;i<NF;i++) { r1["tags"]=r1["tags"] $i " ";}
r1["tags"]=r1["tags"] $i;
}
}
END {
if ( 2 == id_counts ) {
# two matching ends of a pair, should we include them?
if ( (r1["chr"] ~ /chr([[:digit:]]+|[XY]|MT)/) && (r2["chr"] ~ /chr([[:digit:]]+|[XY]|MT)/) &&
(r1["tags"] ~ /XT:A:U/) && (r2["tags"] ~ /XT:A:U/) ) {
print r1["read"];
print r2["read"];
}
}
}
``` |
35790a72-2503-44bd-8d93-ac1e904ac108 | {
"language": "Awk"
} | ```awk
```
Add awk script to deobfuscate wasm stack traces. | ```awk
# Usage:
# awk -f deobfuscate_wasm_log.awk <wat_file> <log_file>
# Process the log file which is the 2nd argument.
FILENAME == ARGV[2] {
match($0, /<anonymous>:wasm-function\[([0-9]+)\]/, groups)
print $0, functions[groups[1]]
}
# Collects function declarations
/^\(func/ {
functions[last_function++] = $2
}
``` |
da664bf0-3ebf-40d8-93d5-35914b4e3f6d | {
"language": "Awk"
} | ```awk
```
Add AWK script to compute the mid-range | ```awk
#!/usr/bin/env awk -f
#
# Computes the mid-range.
#
# Usage: mid-range
#
# Input:
# - a column of numbers
#
# Output:
# - mid-range
!i++ {
# Only for the first record:
max = $1
min = $1
}
{
if ($1 > max) {
max = $1
} else if ($1 < min) {
min = $1
}
}
END {
print (max + min) / 2
}
``` |
10a9f331-bd8e-4bb5-aab3-e55b0ffa781b | {
"language": "Awk"
} | ```awk
```
Add a short program that rewrites the testdata/rsyncd.log timestamps to nowish. | ```awk
BEGIN{
now = systime()
format = "%Y/%m/%d %H:%M:%S"
}
{
split($1, DATE, "/")
split($2, TIME, ":")
$1 = ""
$2 = ""
t = mktime(DATE[1] " " DATE[2] " " DATE[3] " " TIME[1] " " TIME[2] " " TIME[3])
if (delta == "") {
delta = now - t
}
print strftime(format, t + delta) $0
}
``` |
499a6341-f68e-46ff-acad-424216fd0e8f | {
"language": "Awk"
} | ```awk
```
Add an awk script for reading CVC's output. | ```awk
#!/usr/bin/awk -f
BEGIN{
outarr[0] = "";
outarr[1] = "";
outarr[2] = "";
outarr[3] = "";
idx = 0;
}
/.*sparticus.*/{
sub(/bv/, "", $12);
outarr[idx] = $12;
idx++;
if (idx == 4) {
print outarr[0] "|" outarr[1] "|" outarr[2] "|" outarr[3]
idx = 0;
}
}
``` |
0c46ccce-c47a-4a0b-bbed-4a4c1fcaf491 | {
"language": "Awk"
} | ```awk
```
Add for updating the config file | ```awk
# Invoke as awk addloadexample.awk
BEGIN {
lms = 0;
}
tolower($0) ~ /^[# \t]*loadmodule[ \t]/ {
if ( $2 == MODULE "_module" ) {
print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
lms = 2;
next;
}
# test $3 since # LoadModule is split into two tokens
else if ( $3 == MODULE "_module" ) {
print $1 "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
lms = 2;
next;
}
else if ( ! lms ) lms = 1;
}
$0 ~ /^[ \t]*$/ && lms == 1 {
print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
lms = 2;
}
tolower($0) ~ /^[# \t]*include[ \t]/ && $NF == EXAMPLECONF {
lms = 3;
}
{ print }
END {
if ( lms < 3 ) {
if ( ! /^[ \t]*$/ ) print "";
if ( lms < 2 ) {
print "LoadModule " MODULE "_module " LIBPATH "/mod_" MODULE DSO;
print "";
}
if ( length(EXAMPLECONF) ) {
print "# Example mod_" MODULE " configuration";
print "#Include " EXAMPLECONF "\n";
}
}
}
``` |
969239af-8847-45d1-ade6-060a95682605 | {
"language": "Batchfile"
} | ```batchfile
@echo off
start /min java -jar %~dp0SuperTMXMerge.jar %*
```
Improve Windows .bat launcher: waits for close, no console | ```batchfile
@echo off
start /b /wait java -jar %~dp0SuperTMXMerge.jar %*
``` |
52c6621d-db6d-416f-a2e8-22b04194bf2f | {
"language": "Batchfile"
} | ```batchfile
SET PATH=C:\Qt\5.5\mingw492_32\bin;%PATH%
SET PATH=C:\Qt\Tools\mingw492_32\bin;%PATH%
qmake.exe -makefile -win32 FLViz.pro
mingw32-make.exe clean
mingw32-make.exe mocclean
mingw32-make.exe
mingw32-make.exe distclean
```
Comment out removing stuff for now. | ```batchfile
SET PATH=C:\Qt\5.5\mingw492_32\bin;%PATH%
SET PATH=C:\Qt\Tools\mingw492_32\bin;%PATH%
qmake.exe -makefile -win32 FLViz.pro
mingw32-make.exe clean
mingw32-make.exe mocclean
mingw32-make.exe
REM mingw32-make.exe distclean
``` |
f11d1631-0aae-4391-a292-dcbf29a4b7b6 | {
"language": "Batchfile"
} | ```batchfile
:: Set $HOME to the current dir so msys runs here
set HOME=%cd%
:: Configure, build, test, and install using `nmake`.
bash -lc "make"
if errorlevel 1 exit 1
bash -lc "make PREFIX=$LIBRARY_PREFIX install"
if errorlevel 1 exit 1
```
Use the same arguments on Windows. | ```batchfile
:: Set $HOME to the current dir so msys runs here
set HOME=%cd%
:: Configure, build, test, and install using `nmake`.
bash -lc "make"
if errorlevel 1 exit 1
bash -lc "make DYNAMIC_ARCH=1 BINARY=$ARCH NO_LAPACK=0 NO_AFFINITY=1 USE_THREAD=1 PREFIX=$LIBRARY_PREFIX install"
if errorlevel 1 exit 1
``` |
5ed13e7d-9458-436a-a7a3-b8b4784ee586 | {
"language": "Batchfile"
} | ```batchfile
python %RECIPE_DIR%\download-chromedriver
if errorlevel 1 exit 1
7z x chromedriver.zip -ochromedriver
if errorlevel 1 exit 1
REM Add chromedriver to PATH so chromedriver_binary install can find it
set PATH=%PATH%:%CD%\chromedriver
python -m pip install --no-deps --ignore-installed .
```
Fix script path in win | ```batchfile
python %RECIPE_DIR%\download-chromedriver.py
if errorlevel 1 exit 1
7z x chromedriver.zip -ochromedriver
if errorlevel 1 exit 1
REM Add chromedriver to PATH so chromedriver_binary install can find it
set PATH=%PATH%:%CD%\chromedriver
python -m pip install --no-deps --ignore-installed .
``` |
96d3e173-eba6-40ec-a41b-33f5ddcd2be0 | {
"language": "Batchfile"
} | ```batchfile
@ECHO OFF
set GO_ROOT=%~dp0\..\..\..
set JRUBY_BASE=%GO_ROOT%\tools\jruby
set SERVER_ROOT=%GO_ROOT%\server
set RAILS_ROOT=%SERVER_ROOT%\webapp\WEB-INF\rails.new
set GEM_HOME=%RAILS_ROOT%\vendor\bundle\jruby\1.9
set GEM_PATH=%JRUBY_BASE%\lib\ruby\gems\shared;%GEM_HOME%
set PATH=%JRUBY_BASE%\bin;%PATH%
set JRUBY_OPTS="-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Djruby.compile.invokedynamic=false -J-Djruby.compile.mode=OFF %JRUBY_OPTS%"
%JRUBY_BASE%\bin\jruby.bat %*
```
Move to Ruby 2.0 on windows. | ```batchfile
@ECHO OFF
set GO_ROOT=%~dp0\..\..\..
set JRUBY_BASE=%GO_ROOT%\tools\jruby
set SERVER_ROOT=%GO_ROOT%\server
set RAILS_ROOT=%SERVER_ROOT%\webapp\WEB-INF\rails.new
set GEM_HOME=%RAILS_ROOT%\vendor\bundle\jruby\1.9
set GEM_PATH=%JRUBY_BASE%\lib\ruby\gems\shared;%GEM_HOME%
set PATH=%JRUBY_BASE%\bin;%PATH%
set JRUBY_OPTS="-J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Djruby.compat.version=2.0 -J-Djruby.compile.invokedynamic=false -J-Djruby.compile.mode=OFF %JRUBY_OPTS%"
%JRUBY_BASE%\bin\jruby.bat %*
``` |
f2f6bf00-49a9-4580-bd58-1bc1b1f4944a | {
"language": "Batchfile"
} | ```batchfile
@echo off
setlocal EnableDelayedExpansion
REM Uploading all modules at once (with one gradle command) does not work any more, so a separate command for each module must be issued
SET username=%1
SET apikey=%2
SET modules="Spectaculum-Core" "Spectaculum-Camera" "Spectaculum-Image" "Spectaculum-MediaPlayer" "Spectaculum-MediaPlayerExtended" "Spectaculum-Effect-FloAwbs" "Spectaculum-Effect-Immersive" "Spectaculum-Effect-QrMarker"
FOR %%m in (%modules%) DO (
gradlew %%~m:clean %%~m:build %%~m:bintrayUpload -PbintrayUser=%username% -PbintrayKey=%apikey% -PdryRun=false -Pskippasswordprompts
)
```
Fix typo in bintray upload script | ```batchfile
@echo off
setlocal EnableDelayedExpansion
REM Uploading all modules at once (with one gradle command) does not work any more, so a separate command for each module must be issued
SET username=%1
SET apikey=%2
SET modules="Spectaculum-Core" "Spectaculum-Camera" "Spectaculum-Image" "Spectaculum-MediaPlayer" "Spectaculum-MediaPlayerExtended" "Spectaculum-Effect-FlowAbs" "Spectaculum-Effect-Immersive" "Spectaculum-Effect-QrMarker"
FOR %%m in (%modules%) DO (
gradlew %%~m:clean %%~m:build %%~m:bintrayUpload -PbintrayUser=%username% -PbintrayKey=%apikey% -PdryRun=false -Pskippasswordprompts
)
``` |
bafa5cb8-644f-4b2b-8421-cfd0b4788f2e | {
"language": "Batchfile"
} | ```batchfile
@set PATH="%PATH%;C:\Program Files\Java\jdk1.8.0_66\bin"
@c:\Windows\system32\cmd.exe /c %USERPROFILE%\Desktop\sh.exe -l
```
Set Java path for BMC | ```batchfile
@set PATH="%PATH%;C:\Program Files\Java\jdk1.7.0_25\bin"
@c:\Windows\system32\cmd.exe /c %USERPROFILE%\Desktop\sh.exe -l
``` |
124ba46c-a281-4de1-a187-1222a0e7af9f | {
"language": "Batchfile"
} | ```batchfile
@REM Copyright (c) Microsoft. All rights reserved.
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
setlocal
set build-root=%~dp0..
rem // resolve to fully qualified path
for %%i in ("%build-root%") do set build-root=%%~fi
REM -- C --
cd %build-root%\c\build_all\windows
call build.cmd
if errorlevel 1 goto :eof
cd %build-root%
```
Add --run-e2e-tests option to the script ran by Jenkins | ```batchfile
@REM Copyright (c) Microsoft. All rights reserved.
@REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
setlocal
set build-root=%~dp0..
rem // resolve to fully qualified path
for %%i in ("%build-root%") do set build-root=%%~fi
REM -- C --
cd %build-root%\c\build_all\windows
call build.cmd --run-e2e-tests
if errorlevel 1 goto :eof
cd %build-root%
``` |
ccdcb93a-28f1-43a7-b493-f67c128d6486 | {
"language": "Batchfile"
} | ```batchfile
:start
bin\nant\nant.exe -f:spark.build tools build package
pause
goto start
```
Allow number to be passed in to distribution build | ```batchfile
if "%1"=="" build-distribution 1
:start
bin\nant\nant.exe -f:spark.build tools build package -D:build.number=%1
pause
goto start
``` |
f284cdea-3435-458b-b79f-99146474c663 | {
"language": "Batchfile"
} | ```batchfile
@echo off
set PROTODIR=D:\GitHub\SteamKit\Resources\Protobufs
set PROTOBUFS=base_gcmessages gcsdk_gcmessages dota_gcmessages_client
for %%X in ( %PROTOBUFS% ) do (
protoc --descriptor_set_out=%%X.desc --include_imports --proto_path=%PROTODIR% --proto_path=%PROTODIR%\dota --proto_path=%PROTODIR%\steamclient %PROTODIR%\dota\%%X.proto
)
```
Update windows proto generation script to resemble the linux script more closely | ```batchfile
@echo off
set PROTODIR=D:\GitHub\SteamKit\Resources\Protobufs
set PROTOBUFS=base_gcmessages gcsdk_gcmessages cstrike15_gcmessages
for %%X in ( %PROTOBUFS% ) do (
protoc --descriptor_set_out=%%X.desc --include_imports %%X.proto
)
``` |
7461056f-c2a8-44ac-8d65-80eafff1134d | {
"language": "Batchfile"
} | ```batchfile
@echo off
setlocal
set "output=nul"
set "times=1"
goto :parsePackage
:help
:: TODO: put something here.
goto :eof
:usage
call :help 1>&2
exit /b 1
:parsePackage
if "%~1" == "" goto usage
set "package=%~1"
shift
:parseArgs
if "%~1" == "" goto main
if /i "%~1" == "-?" goto help
if /i "%~1" == "-h" goto help
if /i "%~1" == "--help" goto help
if /i "%~1" == "-t" (
set "times=%~2"
shift
)
if /i "%~1" == "--times" (
set "times=%~2"
shift
)
if /i "%~1" == "-o" (
set "output=%~2"
shift
)
if /i "%~1" == "--output" (
set "output=%~2"
shift
)
shift
goto parseArgs
:curl
@powershell -NoProfile "iwr %~1 -OutFile %~2" 2> nul
goto :eof
:downloadPackage
set "url=https://www.nuget.org/api/v2/package/%~1"
call :curl "%url%" %2
goto :eof
:main
for /l %%i in (1, 1, %times%) do (
call :downloadPackage "%package%" "%output%"
)
```
Remove unnecessary uses of "%~1" | ```batchfile
@echo off
setlocal
set "output=nul"
set "times=1"
goto :parsePackage
:help
:: TODO: put something here.
goto :eof
:usage
call :help 1>&2
exit /b 1
:parsePackage
if "%~1" == "" goto usage
set "package=%~1"
shift
:parseArgs
if "%~1" == "" goto main
if /i %1 == "-?" goto help
if /i %1 == "-h" goto help
if /i %1 == "--help" goto help
if /i %1 == "-t" (
set "times=%~2"
shift
)
if /i %1 == "--times" (
set "times=%~2"
shift
)
if /i %1 == "-o" (
set "output=%~2"
shift
)
if /i %1 == "--output" (
set "output=%~2"
shift
)
shift
goto parseArgs
:curl
@powershell -NoProfile "iwr %~1 -OutFile %~2" 2> nul
goto :eof
:downloadPackage
set "url=https://www.nuget.org/api/v2/package/%~1"
call :curl "%url%" %2
goto :eof
:main
for /l %%i in (1, 1, %times%) do (
call :downloadPackage "%package%" "%output%"
)
``` |
a4965040-ed01-4fe2-a7ff-9ac611bd11c5 | {
"language": "Batchfile"
} | ```batchfile
@echo off
setlocal EnableDelayedExpansion
echo Test discovery started...
dir C:\projects\spectre\*Tests.exe /b /s | findstr /v obj > __tmp_gtest.txt
echo Testing (Google Test)...
set failures=0
FOR /F %%i IN (__tmp_gtest.txt) DO (
echo %%i
%%i --gtest_output="xml:%%i.xml"
powershell C:\projects\spectre\scripts\Upload-TestResult.ps1 -fileName %%i.xml
if errorlevel 1 (
set /A failures=%failures%+1
)
)
del __tmp_gtest.txt
EXIT /B %failures%
```
Make native tests fail the build | ```batchfile
@echo off
setlocal EnableDelayedExpansion
echo Test discovery started...
dir C:\projects\spectre\*Tests.exe /b /s | findstr /v obj > __tmp_gtest.txt
echo Testing (Google Test)...
set failures=0
FOR /F %%i IN (__tmp_gtest.txt) DO (
echo %%i
%%i --gtest_output="xml:%%i.xml"
powershell C:\projects\spectre\scripts\Upload-TestResult.ps1 -fileName %%i.xml
IF %ERRORLEVEL% NEQ 0 (
set /A failures=%failures%+1
)
)
del __tmp_gtest.txt
EXIT /B %failures%
``` |
8d6bd944-d60f-41fb-b967-592a1faa528b | {
"language": "Batchfile"
} | ```batchfile
@echo off
REM Make sure to use 32 bit python for this so it runs on all machines
C:\Utils\Python\Python32-34\python ./BuildPrjExeSetup.py py2exe
C:\Utils\Python\Python32-34\python ./BuildEditorApiExeSetup.py py2exe
C:\Utils\Python\Python32-34\python ./BuildReleaseManifesterUpdaterExeSetup.py py2exe
C:\Utils\Python\Python32-34\python ./BuildOpenInVisualStudio.py py2exe
```
Replace absolute path to python with \%PYTHONHOME\%. | ```batchfile
@echo off
REM Make sure to use 32 bit python for this so it runs on all machines
%PYTHONHOME%\python ./BuildPrjExeSetup.py py2exe
%PYTHONHOME%\python ./BuildEditorApiExeSetup.py py2exe
%PYTHONHOME%\python ./BuildReleaseManifesterUpdaterExeSetup.py py2exe
%PYTHONHOME%\python ./BuildOpenInVisualStudio.py py2exe
``` |
3ff0cae4-f942-440c-aee8-4726122e5896 | {
"language": "Batchfile"
} | ```batchfile
SETLOCAL
SET VERSION=%1
CALL Scripts\buildpack %VERSION% || exit /B 1
ECHO this should not happen
exit /B 1
nuget push .\Artifacts\Mapsui.%VERSION%.nupkg -source nuget.org || exit /B 1
nuget push .\Artifacts\Mapsui.Forms.%VERSION%.nupkg -source nuget.org || exit /B 1
git commit -m %VERSION% -a || exit /B 1
git tag %VERSION% || exit /B 1
git push origin %VERSION% || exit /B 1
git push || exit /B 1
```
Revert test code in buidpackpush.bat | ```batchfile
SETLOCAL
SET VERSION=%1
CALL Scripts\buildpack %VERSION% || exit /B 1
nuget push .\Artifacts\Mapsui.%VERSION%.nupkg -source nuget.org || exit /B 1
nuget push .\Artifacts\Mapsui.Forms.%VERSION%.nupkg -source nuget.org || exit /B 1
git commit -m %VERSION% -a || exit /B 1
git tag %VERSION% || exit /B 1
git push origin %VERSION% || exit /B 1
git push || exit /B 1
``` |
13f5a702-8d1d-40d6-9a74-51fa26d2ef4d | {
"language": "Batchfile"
} | ```batchfile
### application.bat - 2015 - HURTAUD ###
version ="2"
build_hour ="11H00"
echo "version${version}";
echo "Copyright company - 2015";
echo "Buil${build_hour";
pause;```
Update header for new member | ```batchfile
### application.bat - 2015 - HURTAUD - Pasquier Rodolphe ###
version ="2"
build_hour ="11H00"
echo "version${version}";
echo "Copyright company - 2015";
echo "Buil${build_hour";
pause;
``` |
81fe7ab1-645d-4a56-a74f-9b6d65fbb161 | {
"language": "Batchfile"
} | ```batchfile
@echo off
setlocal
set OUTDIR=%1
set JSENG=%2
set CYGWIN_ROOT=%~dp0..\..\..\third_party\cygwin\
set GNU_ROOT=%~dp0..\..\..\third_party\gnu\files
set PATH=%CYGWIN_ROOT%bin;%GNU_ROOT%;%SystemRoot%;%SystemRoot%\system32
:: Ensure that the cygwin mount points are defined
CALL %CYGWIN_ROOT%setup_mount.bat > NUL
bash -x create-config.sh %OUTDIR% %JSENG%
```
Fix a build issue with Vista. Stop cp.exe from trying to emulate POSIX security on top of NTFS. | ```batchfile
@echo off
setlocal
set OUTDIR=%1
set JSENG=%2
set CYGWIN_ROOT=%~dp0..\..\..\third_party\cygwin\
set GNU_ROOT=%~dp0..\..\..\third_party\gnu\files
:: Fix cp.exe on vista: without this flag, the files that it creates are not accessible.
set CYGWIN=nontsec
set PATH=%CYGWIN_ROOT%bin;%GNU_ROOT%;%SystemRoot%;%SystemRoot%\system32
:: Ensure that the cygwin mount points are defined
CALL %CYGWIN_ROOT%setup_mount.bat > NUL
bash -x create-config.sh %OUTDIR% %JSENG%
``` |
a20197f0-cf78-4b78-b106-d29a94cf458f | {
"language": "Batchfile"
} | ```batchfile
rem slink /psx /c /p /rmips=GAME/SETUP.REL @GAME/SETUP.LNK,GAME/SETUP.BIN
rem slink /psx /c /p /rmips=GAME/ANDY3.REL @GAME/ANDY3.LNK,GAME/ANDY3.BIN
rem slink /psx /c /p /rmips=GAME/JOBY5.REL @GAME/JOBY5.LNK,GAME/JOBY5.BIN
psylink /c /p /q /rmips=GAME/SETUP.REL @GAME/SETUP.LNK,GAME/SETUP.BIN
psylink /c /p /q /rmips=GAME/ANDY3.REL @GAME/ANDY3.LNK,GAME/ANDY3.BIN
psylink /c /p /q /rmips=GAME/JOBY5.REL @GAME/JOBY5.LNK,GAME/JOBY5.BIN
DEL2FAB /c+ GAME/SETUP```
Add TITSEQ to overlay exporting. | ```batchfile
rem slink /psx /c /p /rmips=GAME/SETUP.REL @GAME/SETUP.LNK,GAME/SETUP.BIN
rem slink /psx /c /p /rmips=GAME/ANDY3.REL @GAME/ANDY3.LNK,GAME/ANDY3.BIN
rem slink /psx /c /p /rmips=GAME/JOBY5.REL @GAME/JOBY5.LNK,GAME/JOBY5.BIN
rem slink /psx /c /p /rmips=GAME/TITSEQ.REL @GAME/TITSEQ.LNK,GAME/TITSEQ.BIN
psylink /c /p /q /rmips=GAME/SETUP.REL @GAME/SETUP.LNK,GAME/SETUP.BIN
psylink /c /p /q /rmips=GAME/ANDY3.REL @GAME/ANDY3.LNK,GAME/ANDY3.BIN
psylink /c /p /q /rmips=GAME/JOBY5.REL @GAME/JOBY5.LNK,GAME/JOBY5.BIN
psylink /c /p /q /rmips=SPEC_PSX/TITSEQ.REL @SPEC_PSX/TITSEQ.LNK,SPEC_PSX/TITSEQ.BIN
DEL2FAB /c+ GAME/SETUP``` |
fba6a5f2-bd8f-48d8-83c0-f5a07fdff521 | {
"language": "Batchfile"
} | ```batchfile
::
:: Create output (Cordova) directory
::
mkdir www
::
:: Install client libraries
::
bower install
::
:: Add target platform
::
:: Comment out the platform(s) your system supports
::
grunt platform:add:ios
:: grunt platform:add:android
::
:: Install cordova plugins
:: There quickest option is to ask from Ionic
:: to restore the state of the app.
:: https://github.com/driftyco/ionic-cli::ionic-state-restore
:: If this process fails comment this line and uncomment the
:: "cordova plugin add ..." lines that follow.
::
ionic state restore
::
:: cordova plugin add cordova-plugin-device
:: cordova plugin add cordova-plugin-console
:: cordova plugin add com.ionic.keyboard
:: cordova plugin add cordova-plugin-inappbrowser
:: cordova plugin add cordova-plugin-geolocation
:: cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
:: cordova plugin add cordova-plugin-network-information
:: cordova plugin add cordova-plugin-whitelist
:: cordova plugin add cordova-plugin-transport-security
::
:: Build the project and generate the cordova directory (www)
::
grunt build
```
Add email composer plugin in .bat file | ```batchfile
::
:: Create output (Cordova) directory
::
mkdir www
::
:: Install client libraries
::
bower install
::
:: Add target platform
::
:: Comment out the platform(s) your system supports
::
grunt platform:add:ios
:: grunt platform:add:android
::
:: Install cordova plugins
:: There quickest option is to ask from Ionic
:: to restore the state of the app.
:: https://github.com/driftyco/ionic-cli::ionic-state-restore
:: If this process fails comment this line and uncomment the
:: "cordova plugin add ..." lines that follow.
::
ionic state restore
::
:: cordova plugin add cordova-plugin-device
:: cordova plugin add cordova-plugin-console
:: cordova plugin add com.ionic.keyboard
:: cordova plugin add cordova-plugin-inappbrowser
:: cordova plugin add cordova-plugin-geolocation
:: cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
:: cordova plugin add de.appplant.cordova.plugin.email-composer
:: cordova plugin add cordova-plugin-network-information
:: cordova plugin add cordova-plugin-whitelist
:: cordova plugin add cordova-plugin-transport-security
::
:: Build the project and generate the cordova directory (www)
::
grunt build
``` |
bec5b7a7-7082-437d-ace7-eaaeaec2132f | {
"language": "Batchfile"
} | ```batchfile
@rem Copyright 2015 Google Inc. All Rights Reserved.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Modify the UIforETW project to be statically linked and build that version
@rem so that it will run without any extra install requirements.
@setlocal
call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
sed "s/UseOfMfc>Dynamic/UseOfMfc>Static/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
sed "s/UIforETW.vcxproj/UIforETWStatic.vcxproj/" <UIforETW.sln >UIforETWStatic.sln
rmdir Release /s/q
devenv /rebuild "release|Win32" UIforETWStatic.sln
del UIforETWStatic.vcxproj
del UIforETWStatic.sln
```
Clean the release directory after doing a static build. | ```batchfile
@rem Copyright 2015 Google Inc. All Rights Reserved.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem Modify the UIforETW project to be statically linked and build that version
@rem so that it will run without any extra install requirements.
@setlocal
call "%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
sed "s/UseOfMfc>Dynamic/UseOfMfc>Static/" <UIforETW.vcxproj >UIforETWStatic.vcxproj
sed "s/UIforETW.vcxproj/UIforETWStatic.vcxproj/" <UIforETW.sln >UIforETWStatic.sln
rmdir Release /s/q
devenv /rebuild "release|Win32" UIforETWStatic.sln
del UIforETWStatic.vcxproj
del UIforETWStatic.sln
@rem Clean up the build directory at the end to avoid subsequent build warnings.
rmdir Release /s/q
``` |
be1ffd9e-c0b4-492e-b852-506132bb56e7 | {
"language": "Batchfile"
} | ```batchfile
@echo off
@echo ...
@echo Running reference documentation Build Script, capturing output to buildlog.txt ...
@echo Start Time: %time%
..\..\build-support\tools\nant\bin\nant %1 %2 %3 %4 %5 %6 %7 %8 %9 > buildlog.txt
@echo ...
@echo ************************
@echo Build Complete!
@echo ************************
@echo End Time: %time%
@echo
```
Print out buildlog.txt to console | ```batchfile
@echo off
@echo ...
@echo Running reference documentation Build Script, capturing output to buildlog.txt ...
@echo Start Time: %time%
..\..\build-support\tools\nant\bin\nant %1 %2 %3 %4 %5 %6 %7 %8 %9 > buildlog.txt
type buildlog.txt
@echo ...
@echo ************************
@echo Build Complete!
@echo ************************
@echo End Time: %time%
@echo
``` |
1c509f10-b29d-4676-abe2-cd4a8379b08e | {
"language": "Batchfile"
} | ```batchfile
@echo off
py25 setup.py --long-description | py25 web\rst2html.py --link-stylesheet --stylesheet=http://www.python.org/styles/styles.css > ~pypi.html
start ~pypi.html
```
Add comment and delete temporary file after use. | ```batchfile
@echo off
REM
REM Convert setup.py's long description to HTML and show it.
REM
py25 setup.py --long-description | py25 web\rst2html.py --link-stylesheet --stylesheet=http://www.python.org/styles/styles.css > ~pypi.html
start ~pypi.html
del ~pypi.html
``` |
616c0d38-3a4a-47e7-ad13-7bcbb7cfcc95 | {
"language": "Batchfile"
} | ```batchfile
xcopy /y .\sourceforge\svn\trunk\src\pyparsing.py .
c:\python27\python c:\python27\scripts\epydoc -v --name pyparsing -o htmldoc --inheritance listed --no-private pyparsing.py
```
Fix relative dir typo in xcopy pyparsing.py command | ```batchfile
xcopy /y ..\sourceforge\svn\trunk\src\pyparsing.py .
c:\python27\python c:\python27\scripts\epydoc -v --name pyparsing -o htmldoc --inheritance listed --no-private pyparsing.py
``` |
700ea8e2-cd12-484b-b9dd-1db83415918d | {
"language": "Batchfile"
} | ```batchfile
# Verify release
SET CURRENT_DIRECTORY=%cd%
call scripts\verifyReleaseWindowsSingleCase.bat %CURRENT_DIRECTORY%\cpp 32 STATIC || exit /b 1
call scripts\verifyReleaseWindowsSingleCase.bat %CURRENT_DIRECTORY%\cpp 32 SHARED || exit /b 1
call scripts\verifyReleaseWindowsSingleCase.bat %CURRENT_DIRECTORY%\cpp 64 STATIC || exit /b 1
call scripts\verifyReleaseWindowsSingleCase.bat %CURRENT_DIRECTORY%\cpp 64 SHARED || exit /b 1
exit 0
```
Fix for release script error when there is space in directory path. | ```batchfile
REM Verify release
SET CURRENT_DIRECTORY=%cd%
call scripts\verifyReleaseWindowsSingleCase.bat "%CURRENT_DIRECTORY%\cpp" 32 STATIC || exit /b 1
call scripts\verifyReleaseWindowsSingleCase.bat "%CURRENT_DIRECTORY%\cpp" 32 SHARED || exit /b 1
call scripts\verifyReleaseWindowsSingleCase.bat "%CURRENT_DIRECTORY%\cpp" 64 STATIC || exit /b 1
call scripts\verifyReleaseWindowsSingleCase.bat "%CURRENT_DIRECTORY%\cpp" 64 SHARED || exit /b 1
exit 0
``` |
0a97a417-c795-42ea-b989-dddaeaef1b14 | {
"language": "Batchfile"
} | ```batchfile
cd VirtIO
call buildall.bat
cd ..
cd NetKVM
call buildall.bat
cd ..
cd viostor
call buildall.bat
cd ..
cd vioscsi
call buildall.bat
cd ..
cd Balloon
call buildall.bat
cd ..
cd vioserial
call buildall.bat
cd ..
cd viorng
call buildall.bat
cd ..
cd pvpanic
call buildall.bat
cd ..
```
Add vioinput to the top-level build script | ```batchfile
cd VirtIO
call buildall.bat
cd ..
cd NetKVM
call buildall.bat
cd ..
cd viostor
call buildall.bat
cd ..
cd vioscsi
call buildall.bat
cd ..
cd Balloon
call buildall.bat
cd ..
cd vioserial
call buildall.bat
cd ..
cd viorng
call buildall.bat
cd ..
cd vioinput
call buildall.bat
cd ..
cd pvpanic
call buildall.bat
cd ..
``` |
b3d8d230-4e69-48b8-8639-d4a6912c11aa | {
"language": "Batchfile"
} | ```batchfile
rem Won't be found because there are no shebang lines on Windows
rem python test-script-setup.py
rem if errorlevel 1 exit 1
rem python test-script-setup.py | grep "Test script setup\.py"
rem if errorlevel 1 exit 1
test-script-manual
if errorlevel 1 exit 1
test-script-manual | grep "Manual entry point"
if errorlevel 1 exit 1
```
Use absolute path to setup.py-installed entry point | ```batchfile
rem We have to use the absolute path because there is no "shebang line" in Windows
python "%PREFIX%\Scripts\test-script-setup.py"
if errorlevel 1 exit 1
python "%PREFIX%\Scripts\test-script-setup.py" | grep "Test script setup\.py"
if errorlevel 1 exit 1
test-script-manual
if errorlevel 1 exit 1
test-script-manual | grep "Manual entry point"
if errorlevel 1 exit 1
``` |
42ae313b-d56b-42d2-ae58-94a50f0dce10 | {
"language": "Batchfile"
} | ```batchfile
@echo off
set zipcmd=%~dp0\tools\7z\7z.exe
pushd %~dp0\..\..
%zipcmd% a -r -x!scripts -xr!.* -x!__pycache__ blenderseed-x.x.x-yyyy.zip blenderseed
popd
move ..\..\blenderseed-x.x.x-yyyy.zip .
pause
```
Exclude README.md file from package | ```batchfile
@echo off
set zipcmd=%~dp0\tools\7z\7z.exe
pushd %~dp0\..\..
%zipcmd% a -r -x!scripts -xr!.* -x!__pycache__ -x!README.md blenderseed-x.x.x-yyyy.zip blenderseed
popd
move ..\..\blenderseed-x.x.x-yyyy.zip .
pause
``` |
c3731373-2d51-4470-bc15-845a228c4ba9 | {
"language": "Batchfile"
} | ```batchfile
@pushd %~dp0
ECHO Remember to build the solution first!
REM pause
"%~dp0\TestHarness\packages\NUnit.Runners.2.6.3\tools\nunit-console.exe" "%~dp0\TestHarness\nunit\bin\Debug\nunitHarness.dll" /result=results-example-nunit.xml /nologo /nodots
pause
@popd```
Make script independent of NUnit version | ```batchfile
@pushd %~dp0
ECHO Remember to build the solution first!
REM pause
Cd "%~dp0\TestHarness\packages\NUnit.Runners.*\tools"
"nunit-console.exe" "%~dp0\TestHarness\nunit\bin\Debug\nunitHarness.dll" /result="%~dp0\results-example-nunit.xml" /nologo /nodots
pause
@popd``` |
1bbb3f55-25f6-4de5-ba05-b1865b4d743c | {
"language": "Batchfile"
} | ```batchfile
rem Won't be found because there are no shebang lines on Windows
rem python test-script-setup.py
rem if errorlevel 1 exit 1
rem python test-script-setup.py | grep "Test script setup\.py"
test-script-manual
if errorlevel 1 exit 1
test-script-manual | grep "Manual entry point"
```
Add missing "if errorlevel 1 exit 1" lines | ```batchfile
rem Won't be found because there are no shebang lines on Windows
rem python test-script-setup.py
rem if errorlevel 1 exit 1
rem python test-script-setup.py | grep "Test script setup\.py"
rem if errorlevel 1 exit 1
test-script-manual
if errorlevel 1 exit 1
test-script-manual | grep "Manual entry point"
if errorlevel 1 exit 1
``` |
41d347de-2388-4338-99ed-43c50d90c9e6 | {
"language": "Batchfile"
} | ```batchfile
```
Add batch script to remove a git submodule from a local workspace | ```batchfile
@rem This is a simple batch script to remove a submodule reference from a
@rem working directory
@rem Call the script by
@rem 1) cd path\to\your\workspace
@rem 2) path\to\removeSubmodule.bat submoduleName
@rem See https://stackoverflow.com/questions/1260748/how-do-i-remove-a-git-submodule for more details
@echo Removing submodule %1
git submodule deinit %1
git rm %1
git rm --cached %1
rm -rf .git/modules/%1
``` |
b54e0173-0822-417a-8f2c-476709343be3 | {
"language": "Batchfile"
} | ```batchfile
@echo off
setlocal
set mypath=%~dp0
set PYTHONPATH=pkgs
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set common="%COMMONPROGRAMFILES%"
) else (
set common="%COMMONPROGRAMFILES(x86)%"
)
REM Start the DbServer in background but within the same context
start "OpenQuake DB server" /B %common%\Python\2.7\python.exe -m openquake.server.dbserver
REM Make sure that the dbserver is up and running
echo Please wait ...
if exist C:\Windows\System32\timeout.exe (
timeout /t 10 /nobreak > NUL
) else (
REM Windows XP hack
ping 192.0.2.2 -n 1 -w 10000 > NUL
)
REM Start the WebUI using django
%common%\Python\2.7\python.exe -m openquake.server.manage runserver %*
endlocal
```
Make sure DB exists and is aligned before running the server | ```batchfile
@echo off
setlocal
set mypath=%~dp0
set PYTHONPATH=pkgs
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set common="%COMMONPROGRAMFILES%"
) else (
set common="%COMMONPROGRAMFILES(x86)%"
)
REM Start the DbServer in background but within the same context
start "OpenQuake DB server" /B %common%\Python\2.7\python.exe -m openquake.server.dbserver
REM Make sure that the dbserver is up and running
echo Please wait ...
if exist C:\Windows\System32\timeout.exe (
timeout /t 10 /nobreak > NUL
) else (
REM Windows XP hack
ping 192.0.2.2 -n 1 -w 10000 > NUL
)
REM Create the DB or update it
%common%\Python\2.7\python.exe -m openquake.server.db.upgrade_manager
REM Start the WebUI using django
%common%\Python\2.7\python.exe -m openquake.server.manage runserver %*
endlocal
``` |
d9bd621d-e18e-4a38-9732-3103eea120de | {
"language": "Batchfile"
} | ```batchfile
```
Revert "Now processing a template to produce a valid submit file." | ```batchfile
universe = vanilla
executable = ./x_job_filexfer_testjob.pl
log = job_filexfer_input-onegone_van.log
output = job_filexfer_input-onegone_van.out
error = job_filexfer_input-onegone_van.err
input = job_14711_dir/submit_filetrans_input14711.txt
transfer_input_files = job_14711_dir/submit_filetrans_input14711a.txt,job_14711_dir/submit_filetrans_input14711b.txt,job_14711_dir/submit_filetrans_input14711c.txt
filetrans_input6492c.txt
should_transfer_files = YES
when_to_transfer_output = ON_EXIT
Notification = NEVER
arguments = --job=14711 --extrainput
queue
``` |
621b8471-8ea9-4931-8e21-8c41631a77d2 | {
"language": "Batchfile"
} | ```batchfile
@echo off
set GOARCH=%1
IF "%1" == "" (set GOARCH=amd64)
set ORG_PATH=github.com\hashicorp
set REPO_PATH=%ORG_PATH%\consul
set GOPATH=%cd%\gopath
rmdir /s /q %GOPATH%\src\%REPO_PATH% 2>nul
mkdir %GOPATH%\src\%ORG_PATH% 2>nul
mklink /J "%GOPATH%\src\%REPO_PATH%" "%cd%" 2>nul
%GOROOT%\bin\go build -o bin\%GOARCH%\consul.exe %REPO_PATH%
```
Add Instructions on Downloading Mingw 64bit for Building memdb | ```batchfile
@echo off
REM Download Mingw 64 on Windows from http://win-builds.org/download.html
set GOARCH=%1
IF "%1" == "" (set GOARCH=amd64)
set ORG_PATH=github.com\hashicorp
set REPO_PATH=%ORG_PATH%\consul
set GOPATH=%cd%\gopath
rmdir /s /q %GOPATH%\src\%REPO_PATH% 2>nul
mkdir %GOPATH%\src\%ORG_PATH% 2>nul
go get .\...
mklink /J "%GOPATH%\src\%REPO_PATH%" "%cd%" 2>nul
%GOROOT%\bin\go build -o bin\%GOARCH%\consul.exe %REPO_PATH%``` |
7c0648af-0b90-478f-abb0-9285f63aab58 | {
"language": "Batchfile"
} | ```batchfile
sed -i 's/gnu/msvc/' changeforest-r/src/Makevars.win
sed -i '1s/^/export CXX_STD=CXX11\n/' Makevars.win
sed -i '1s/^/export PKG_CXXFLAGS=$(CXX_VISIBILITY)\n/' Makevars.win
"%R%" CMD INSTALL --build changeforest-r
IF %ERRORLEVEL% NEQ 0 exit 1```
Use the correct path for makevars. | ```batchfile
sed -i 's/gnu/msvc/' changeforest-r/src/Makevars.win
sed -i '1s/^/export CXX_STD=CXX11\n/' changeforest-r/src/Makevars.win
sed -i '1s/^/export PKG_CXXFLAGS=$(CXX_VISIBILITY)\n/' changeforest-r/src/Makevars.win
"%R%" CMD INSTALL --build changeforest-r
IF %ERRORLEVEL% NEQ 0 exit 1``` |
a586791e-f463-4f58-bb4d-e76784cfd595 | {
"language": "Batchfile"
} | ```batchfile
@REM
@REM Copyright 2010-2017 Boxfuse GmbH
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@Echo off
setlocal
@REM Set the current directory to the installation directory
set INSTALLDIR=%~dp0
if exist "%INSTALLDIR%\jre\bin\java.exe" (
set JAVA_CMD="%INSTALLDIR%\jre\bin\java.exe"
) else (
@REM Use JAVA_HOME if it is set
if "%JAVA_HOME%"=="" (
set JAVA_CMD=java
) else (
set JAVA_CMD="%JAVA_HOME%\bin\java.exe"
)
)
%JAVA_CMD% -cp "%INSTALLDIR%\lib\*;%INSTALLDIR%\drivers\*" org.flywaydb.commandline.Main %*
@REM Exit using the same code returned from Java
EXIT /B %ERRORLEVEL%
```
Use Windows CLASSPATH environment variable | ```batchfile
@REM
@REM Copyright 2010-2017 Boxfuse GmbH
@REM
@REM Licensed under the Apache License, Version 2.0 (the "License");
@REM you may not use this file except in compliance with the License.
@REM You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing, software
@REM distributed under the License is distributed on an "AS IS" BASIS,
@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@REM See the License for the specific language governing permissions and
@REM limitations under the License.
@REM
@Echo off
setlocal
@REM Set the current directory to the installation directory
set INSTALLDIR=%~dp0
if exist "%INSTALLDIR%\jre\bin\java.exe" (
set JAVA_CMD="%INSTALLDIR%\jre\bin\java.exe"
) else (
@REM Use JAVA_HOME if it is set
if "%JAVA_HOME%"=="" (
set JAVA_CMD=java
) else (
set JAVA_CMD="%JAVA_HOME%\bin\java.exe"
)
)
SET CP=
IF DEFINED CLASSPATH ( SET CP=%CLASSPATH%;)
%JAVA_CMD% -cp "%CP%%INSTALLDIR%\lib\*;%INSTALLDIR%\drivers\*" org.flywaydb.commandline.Main %*
@REM Exit using the same code returned from Java
EXIT /B %ERRORLEVEL%
``` |
eb493c92-f484-4575-8289-c63266e4c4da | {
"language": "Batchfile"
} | ```batchfile
```
Add script to disable intel context menu | ```batchfile
@echo off
setlocal EnableDelayedExpansion
set registryRoot=HKCU\Software\Classes
set key=igfxcui
reg add "%registryRoot%\Directory\Background\shellex\ContextMenuHandlers\%key%" /d "---" /f
set key=igfxDTCM
reg add "%registryRoot%\Directory\Background\shellex\ContextMenuHandlers\%key%" /d "---" /f
``` |
a439ed37-25b4-4b89-b6ae-9ec65d824c3b | {
"language": "Batchfile"
} | ```batchfile
```
Add build script for installation | ```batchfile
#!/bin/bash
PATH=/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
EXEC_DIR="/usr/local/bin" # set to anywhere seen by $PATH
CONF_DIR="/etc/distributed-motion-s3" # default location to store config files (*.toml)
# build dms3 components
#
echo 'building dms3 components...'
go build go_dms3client.go
go build go_dms3server.go
go build go_dms3mail.go
# move components into /usr/local/bin
#
echo 'moving dms3 components to' ${EXEC_DIR} '(root permissions expected)...'
mv go_dms3client ${EXEC_DIR}
mv go_dms3server ${EXEC_DIR}
mv go_dms3mail ${EXEC_DIR}
# copy TOML files into /etc/distributed-motion-s3
#
echo 'copying dms3 component config files to' ${CONF_DIR} '(root permissions expected)...'
mkdir -p ${CONF_DIR}
cp dms3client.toml ${CONF_DIR}
cp dms3libs.toml ${CONF_DIR}
cp dms3server.toml ${CONF_DIR}
cp dms3mail.toml ${CONF_DIR}``` |
a6564743-238b-40c9-ae60-fe0c4d1a13be | {
"language": "Batchfile"
} | ```batchfile
@echo off
if not "%1" == "" goto continue
if not exist imaginary\obj mkdir imaginary\obj
for %%i in (imaginary\*.yca) do call %0 %%~ni
goto end
:continue
echo Processing %1
main imaginary\%1.yca -mshl -o imaginary\obj\%1 > imaginary\obj\%1.txt 2>&1
goto end
:end
```
Change the executable from main to firstify | ```batchfile
@echo off
if not "%1" == "" goto continue
if not exist imaginary\obj mkdir imaginary\obj
for %%i in (imaginary\*.yca) do call %0 %%~ni
goto end
:continue
echo Processing %1
firstify imaginary\%1.yca -mshl -o imaginary\obj\%1 > imaginary\obj\%1.txt 2>&1
goto end
:end
``` |
4b882805-7d4e-45e0-84d3-c008ed1461e7 | {
"language": "Batchfile"
} | ```batchfile
@echo off
pushd %~dp0
dotnet publish tools\Build\Build.csproj --output tools\bin\Build --nologo --verbosity quiet
if %errorlevel% equ 0 dotnet tools\bin\Build\Build.dll %*
popd
```
Return error level from batch file. | ```batchfile
@echo off
pushd %~dp0
dotnet publish tools\Build\Build.csproj --output tools\bin\Build --nologo --verbosity quiet
if %errorlevel% equ 0 dotnet tools\bin\Build\Build.dll %*
popd
exit /b %errorlevel%
``` |
1a837f18-9584-4ea0-be2a-6ca540afd167 | {
"language": "Batchfile"
} | ```batchfile
@echo off
if "%~1"=="" (
call :Usage
goto :EOF
)
call bootstrap.cmd
pushd "%~dp0"
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set ProgramFilesDir=%ProgramFiles%
if NOT "%ProgramFiles(x86)%"=="" set ProgramFilesDir=%ProgramFiles(x86)%
set VisualStudioCmd=%ProgramFilesDir%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
if EXIST "%VisualStudioCmd%" call "%VisualStudioCmd%"
set NUnitDir=Tools\NUnit.ConsoleRunner
if EXIST "%NUnitDir%\tools" set NUnitBinDir=%NUnitDir%\tools
if NOT EXIST "%NUnitBinDir%" echo Missing NUnit, expected in %NUnitDir%
if NOT EXIST "%NUnitBinDir%" exit /b -1
set FrameworkVersion=v4.0.30319
set FrameworkDir=%SystemRoot%\Microsoft.NET\Framework
PATH=%FrameworkDir%\%FrameworkVersion%;%NUnitDir%;%JAVA_HOME%\bin;%PATH%
msbuild.exe Waffle.proj /t:%*
if NOT %ERRORLEVEL%==0 exit /b %ERRORLEVEL%
popd
endlocal
exit /b 0
goto :EOF
:Usage
echo Syntax:
echo.
echo build [target] /p:Configuration=[Debug (default),Release]
echo.
echo Target:
echo.
echo all : build everything
echo.
echo Examples:
echo.
echo build all
echo build all /p:Configuration=Release
goto :EOF
```
Update to visual studio 2015 | ```batchfile
@echo off
if "%~1"=="" (
call :Usage
goto :EOF
)
call bootstrap.cmd
pushd "%~dp0"
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
set ProgramFilesDir=%ProgramFiles%
if NOT "%ProgramFiles(x86)%"=="" set ProgramFilesDir=%ProgramFiles(x86)%
set VisualStudioCmd=%ProgramFilesDir%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
if EXIST "%VisualStudioCmd%" call "%VisualStudioCmd%"
set NUnitDir=Tools\NUnit.ConsoleRunner
if EXIST "%NUnitDir%\tools" set NUnitBinDir=%NUnitDir%\tools
if NOT EXIST "%NUnitBinDir%" echo Missing NUnit, expected in %NUnitDir%
if NOT EXIST "%NUnitBinDir%" exit /b -1
set FrameworkVersion=v4.0.30319
set FrameworkDir=%SystemRoot%\Microsoft.NET\Framework
PATH=%FrameworkDir%\%FrameworkVersion%;%NUnitDir%;%JAVA_HOME%\bin;%PATH%
msbuild.exe Waffle.proj /t:%*
if NOT %ERRORLEVEL%==0 exit /b %ERRORLEVEL%
popd
endlocal
exit /b 0
goto :EOF
:Usage
echo Syntax:
echo.
echo build [target] /p:Configuration=[Debug (default),Release]
echo.
echo Target:
echo.
echo all : build everything
echo.
echo Examples:
echo.
echo build all
echo build all /p:Configuration=Release
goto :EOF
``` |
8ea099ff-a8bf-491a-965a-13efb4693f55 | {
"language": "Batchfile"
} | ```batchfile
@echo off
cls
SET BUILD_DIR=%~dp0\build
SET TOOLS_DIR=%BUILD_DIR%\tools
SET NUGET_PATH=%TOOLS_DIR%\nuget.exe
IF NOT EXIST %TOOLS_DIR%\ (
mkdir %TOOLS_DIR%
)
IF NOT EXIST %NUGET_PATH% (
echo Downloading NuGet.exe ...
powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe -OutFile %NUGET_PATH%"
)
IF NOT EXIST "%TOOLS_DIR%\FAKE.Core\tools\Fake.exe" (
%NUGET_PATH% install "FAKE.Core" -Version 4.63.2 -OutputDirectory %TOOLS_DIR% -ExcludeVersion
)
IF NOT EXIST "%TOOLS_DIR%\NUnit.Runners.2.6.2\" (
%NUGET_PATH% install "NUnit.Runners" -Version 2.6.2 -OutputDirectory %TOOLS_DIR%
)
echo Running FAKE Build...
%TOOLS_DIR%\FAKE.Core\tools\Fake.exe build.fsx %* -BuildDir=%BUILD_DIR%
```
Speed up NuGet binary download | ```batchfile
@echo off
cls
SET BUILD_DIR=%~dp0\build
SET TOOLS_DIR=%BUILD_DIR%\tools
SET NUGET_PATH=%TOOLS_DIR%\nuget.exe
IF NOT EXIST %TOOLS_DIR%\ (
mkdir %TOOLS_DIR%
)
IF NOT EXIST %NUGET_PATH% (
echo Downloading NuGet.exe ...
powershell -Command "Start-BitsTransfer -Source https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe -Destination %NUGET_PATH%"
)
IF NOT EXIST "%TOOLS_DIR%\FAKE.Core\tools\Fake.exe" (
%NUGET_PATH% install "FAKE.Core" -Version 4.63.2 -OutputDirectory %TOOLS_DIR% -ExcludeVersion
)
IF NOT EXIST "%TOOLS_DIR%\NUnit.Runners.2.6.2\" (
%NUGET_PATH% install "NUnit.Runners" -Version 2.6.2 -OutputDirectory %TOOLS_DIR%
)
echo Running FAKE Build...
%TOOLS_DIR%\FAKE.Core\tools\Fake.exe build.fsx %* -BuildDir=%BUILD_DIR%
``` |
717f08f6-687e-4434-8528-dcaec3ef2d3b | {
"language": "Batchfile"
} | ```batchfile
@echo off
set DIST_DIR=dist
set CERTIFICATE_STORE=Root
set CERTIFICATE_NAME="Nuxeo Drive SPC"
set MSI_PROGRAM_NAME="Nuxeo Drive"
set TIMESTAMP_URL=http://timestamp.verisign.com/scripts/timstamp.dll
set SIGN_CMD=signtool sign /v /s %CERTIFICATE_STORE% /n %CERTIFICATE_NAME% /d %MSI_PROGRAM_NAME% /t %TIMESTAMP_URL%
set VERIFY_CMD=signtool verify /v /pa
FOR %%F IN (%DIST_DIR%\*.msi) DO (
echo ---------------------------------------------
echo Signing %%F
echo ---------------------------------------------
echo %SIGN_CMD% %%F
%SIGN_CMD% %%F
echo ---------------------------------------------
echo Verifying %%F
echo ---------------------------------------------
echo %VERIFY_CMD% %%F
%VERIFY_CMD% %%F
)
```
Use PFX certificate file when signing msi | ```batchfile
@echo off
set DIST_DIR=dist
set CERTIFICATE_PATH=%HOMEPATH%\certificates\nuxeo.com.pfx
set MSI_PROGRAM_NAME="Nuxeo Drive"
set TIMESTAMP_URL=http://timestamp.verisign.com/scripts/timstamp.dll
set SIGN_CMD=signtool sign /v /f %CERTIFICATE_PATH% /d %MSI_PROGRAM_NAME% /t %TIMESTAMP_URL%
set VERIFY_CMD=signtool verify /v /pa
FOR %%F IN (%DIST_DIR%\*.msi) DO (
echo ---------------------------------------------
echo Signing %%F
echo ---------------------------------------------
echo %SIGN_CMD% %%F
%SIGN_CMD% %%F
echo ---------------------------------------------
echo Verifying %%F
echo ---------------------------------------------
echo %VERIFY_CMD% %%F
%VERIFY_CMD% %%F
)
``` |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.