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
import java.io.BufferedReader; | |
import java.io.FileReader; | |
import java.util.Arrays; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
public class A { | |
public static int solution(int N) { | |
int[] seen; | |
int i; |
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 | |
IFS= read -rd '' index_filter <<\Command | |
git ls-files -s | \ | |
awk ' | |
BEGIN { FS="\t" } | |
$2 ~ /(^|\/)-i$/ {next} | |
$2 ~ /Makefile$/ {next} | |
$2 ~ /[#~]$/ {next} |
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 | |
shopt -s extdebug extglob | |
k0ud3() { | |
local cmd=$1 | |
case $cmd in | |
+([[:digit:]])@([*+/-])+([[:digit:]])):;; | |
*)! :;; | |
esac && eval echo "$(($cmd))" |
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 | |
: <<\eof | |
Behavior of shells when IFS='\' | |
The case when IFS='\' is tricky for the following situations: | |
- read with -r | |
- read without -r | |
- a parameter expansion, unquoted, that contains the backslash |
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 | |
save=$(bind -p; bind -X) | |
function clean-up { | |
bind -r '\C-i' | |
bind -f /dev/stdin <<< "$save" | |
} | |
trap 'clean-up' RETURN | |
function write-options { |
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
#include <stdlib.h> | |
#include <sys/time.h> | |
#include <signal.h> | |
void on_sigalrm(int sig) { | |
return; | |
} | |
int main(int argc, char *argv[]) { | |
float wait; |
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 | |
stty=$(stty -g) | |
trap 'stty "$stty"' EXIT | |
stty raw | |
IFS= read -rs -N1 a | |
while read -t0; do | |
IFS= read -rs -N1 b | |
a+=$b | |
done |
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
KERNEL/DIRS.A86:; Copyright Work of Caldera, Inc. All Rights Reserved. | |
KERNEL/DIRS.A86:; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, | |
KERNEL/CDEVIO.A86:; Copyright Work of Caldera, Inc. All Rights Reserved. | |
KERNEL/CDEVIO.A86:; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, | |
KERNEL/DRIVER.EQU:; Copyright Work of Caldera, Inc. All Rights Reserved. | |
KERNEL/DRIVER.EQU:; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, | |
KERNEL/FDOS.A86:; Copyright Work of Caldera, Inc. All Rights Reserved. | |
KERNEL/FDOS.A86:; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, | |
KERNEL/NETWORK.A86:; Copyright Work of Caldera, Inc. All Rights Reserved. | |
KERNEL/NETWORK.A86:; THIS WORK IS A COPYRIGHT WORK AND CONTAINS CONFIDENTIAL, |
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 | |
for shell in zsh ksh mksh dash bash /bin/bash 'busybox sh'; do | |
echo "$shell": | |
$shell <<'eof' | |
set -x | |
PATH= | |
echo "PATH=$PATH" | |
ls | |
eof |
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
zsh: | |
+zsh:4> command -v xyz | |
xyz | |
+zsh:5> unset xyz | |
+zsh:6> command -v xyz | |
xyz | |
+zsh:8> PATH='' | |
+zsh:9> command -v xyz | |
xyz | |
+zsh:10> PATH=: |
NewerOlder