This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ksh | |
# Testcase runs in ksh93t or greater. Tests should run in any shell provided | |
# you can supply all the necessary workarounds, and they correctly interpret | |
# ksh93 printf %q output (requires $'...'). At least one level of recursive | |
# arithmetic variable evaluation must also be supported. | |
# Dan Douglas <ormaaj@gmail.com> | |
namespace main { | |
# e.g. add "set -x" to hacks | |
typeset -A shells=( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
${ZSH_VERSION+false} || emulate ksh | |
${BASH_VERSION+shopt -s lastpipe extglob} | |
# colorSet [ --setaf | --setab | --misc ] var | |
# Assigns the selected set of escape mappings to the given associative array names. | |
function colorSet { | |
typeset -a clrs msc | |
typeset x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# /etc/portage/bashrc | |
# Dan Douglas <ormaaj@gmail.com> | |
[[ $EBUILD_PHASE != setup ]] && return | |
# Set up the initial associative array of CFLAGS and CXXFLAGS. | |
# Takes an array name to assign and optionally the names of "flag groups" to include. | |
# setupFlags arrname groupname [ groupname ... ] | |
setupFlags() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Only ksh93 has "real" C++-like references (called namerefs). They can be used | |
# as reference parameters for passing data structures like arrays in and out of | |
# functions. Bash 4.3+ and mksh also have a nameref feature, but unlike ksh93, | |
# which has three different kinds of nameref, bash supports just two of these | |
# and mksh only one (the for-loop type won't be illustrated here). It is the | |
# "dynamic" kind of nameref that is supported by all three, which is mostly | |
# just sugar for Bash's old "${!var}" behavior (ksh93 also uses this kind when | |
# a nameref doesn't refer to a positional parameter). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exploit this vulnerable program to run an arbitrary command without renaming or adding any files. | |
k# ksh -c 'touch printf "you fail\n"; printf "%s: " "give me a value"; read -r b; a=(~(N)*); "${a[@]}" "$b" "$@"' _ args...; code... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
${BASH_VERSION+shopt -s extglob lastpipe} 2>/dev/null | |
# Full path to a file to store our date offset data. Will be overwritten. | |
datefile=./datefile | |
# Assign your vars or insert whatever code does so here. | |
user=foouser password=mypassword db=mydbname | |
function doit { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess, itertools | |
class Shell(list): | |
def __init__(self, shell, cmds): | |
self.shell = shell | |
super().__init__([(x, self.__run(x)) for x in cmds]) | |
def __iter__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4.2.45(1)-release | |
var=${a[*]} ... one two three four | |
var="${a[*]}" ... one:::two:three:::four | |
var=$* ... one:::two:three:::four | |
var="$*" ... one:::two:three:::four | |
var=${a[@]} ... one two three four | |
var="${a[@]}" ... one:::two three:::four | |
var=$@ ... one two three four | |
var="$@" ... one:::two three:::four |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace Program { | |
public abstract class A { | |
protected abstract string Name { get; set; } | |
public abstract void Print(); | |
} | |
class B : A { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Reflection; | |
namespace Program { | |
interface Ifc1 { void Print(string s); } | |
interface Ifc2 { void Print(string s); } |