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
local Thing = {} | |
Thing.list = {} | |
Thing.one = function(self) | |
table.insert(self.list, "one") | |
return self | |
end | |
Thing.two = function(self) | |
table.insert(self.list, "two") | |
return self | |
end |
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
echo ">> Tooltip: $(whatis $(ls $(echo $PATH | tr : ' ') 2>/dev/null | shuf -n 1))" |
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 | |
PATCH_ARGS='' | |
DELIMITER=__DIFF__ | |
REALPATH=$(realpath $0) | |
DATA=$(tail -n +$(( $(grep -n $DELIMITER $REALPATH | tail -n 1 | cut -d : -f 1) + 1 )) $REALPATH) | |
printf '%s\n' "$DATA" | patch $PATCH_ARGS | |
exit 0 | |
__DIFF__ | |
--- one 2016-12-07 13:39:56.974517071 -0600 | |
+++ two 2016-12-07 13:40:28.733159927 -0600 |
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
class Thing | |
attr_accessor :color, :size | |
def initialize args = {} | |
args.each_pair do |k,v| | |
if self.respond_to?(k) | |
self.send("#{k}=", v) | |
else | |
raise ArgumentError.new "unknown property: #{k}" | |
end | |
end |
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
PROMPT="cool-tool>" | |
function do_one { | |
echo "one" | |
} | |
function do_two { | |
echo "two" | |
} |
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
# as commonly seen elsewhere, -X POST is unneccesary because --data triggers POST method to be used | |
curl --header "Content-Type: application/json" --data "[\"Testing\":\"Logging\"}" http://example.com/ |
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
# view MBR with partition table | |
sudo dd if=/dev/sda bs=512 count=1 | hexdump -C | |
# backup MBR without partition table | |
sudo dd if=/dev/sda of=mbr.backup bs=446 count=1 |
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
ip addr show | grep 'inet ' | grep -v -E 'lo$' | awk -F ' ' '{print $NF, "\t", $2}' |
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
ssh user@host 'bash -s' < /path/to/my-script.sh |
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
host $(host $THE_DNSNAME | awk -F ' ' '{print $4}') |
NewerOlder