A couple of solutions to CS50 problem 2 ("vanity plates") along with a simple test suite.
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 | |
# Split a certificate bundle into individual certificates. | |
# | |
# This will produce files named `cert-000.crt`, `cert-001.crt`, .etc. | |
read -r count < <(csplit -z "$1" -f cert- -b '%03d.crt' '/^-----BEGIN CERTIFICATE-----/' '{*}' | wc -l) | |
echo "split $count certificates" |
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
CFLAGS = -g | |
example: example.o rom.o | |
$(CC) -o $@ $^ | |
rom.o: rom.S rom.bin | |
rom.bin: | |
echo -n -e '\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00' > $@ |
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 | |
# Create the substitute of C | |
git update-ref refs/heads/main $(git log -1 --pretty=%B $C | GIT_AUTHOR_NAME=$(git log -1 --pretty=%an $C) \ | |
GIT_AUTHOR_DATE=$(git log -1 --pretty=%ad --date=iso $C) \ | |
GIT_COMMITTER_NAME=$(git log -1 --pretty=%cn $C) \ | |
GIT_COMMITTER_DATE=$(git log -1 --pretty=%cd --date=iso $C) \ | |
git commit-tree -p $A -p $B -F - $C^{tree}) | |
git update-ref refs/heads/main $(git log -1 --pretty=%B $D | GIT_AUTHOR_NAME=$(git log -1 --pretty=%an $D) \ |
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
kprobe:fib_validate_source { | |
$skb = (struct sk_buff*) arg0; | |
@skb[tid] = $skb; | |
@ipheader[tid] = ((struct iphdr *) ($skb->head + $skb->network_header)); | |
} | |
kretprobe:fib_validate_source { | |
$skb = @skb[tid]; | |
$ipheader = @ipheader[tid]; | |
$version = $ipheader->version; |
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/sh | |
SERIAL1=( -chardev stdio,id=uart1 -serial chardev:uart1 -monitor none ) | |
SERIAL2=( -serial vc -serial vc ) | |
SERIAL3=( -nographic -serial mon:stdio ) | |
EMU_RASPI=( -M raspi3 ) | |
EMU_VIRT=( -M virt -cpu cortex-a72 ) | |
NET_TAP=( |
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
{ | |
"definitions": { | |
"Group": { | |
"description": "A user.openshift.io/v1 Group", | |
"properties": { | |
"apiVersion": { | |
"default": "user.openshift.io/v1", | |
"title": "Apiversion", | |
"type": "string" | |
}, |
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