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
<body ng-controller="MainController"> | |
<h4>Which Star Wars Episodes Were Good/Bad?</h4> | |
<div ng-switch on="quality"> | |
<div ng-switch-when="bad"> | |
Episodes IV, V ,VI | |
</div> | |
<div ng-switch-when="good"> | |
Episodes I, II, III | |
</div> |
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 | |
# replace spaces with underscores in file names | |
ls | while read file | |
do | |
mv "$file" "$(echo "$file" | sed -e 's/\ /_/g')" | |
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
#!/bin/bash | |
# | |
# example usage | |
# | |
# > mem 0.1 100 | |
for i in `seq 1 $2` | |
do | |
free -m | |
cat /proc/meminfo | grep MemFree |
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
SELECT table_name | |
FROM INFORMATION_SCHEMA.views | |
WHERE table_schema = ANY (current_schemas(false)); |
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
SELECT count(*) | |
FROM pg_stat_activity | |
WHERE pid != pg_backend_pid() | |
AND usename = current_user; |
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 i in $(ls) | |
do | |
without=$(cat $i | wc -c) | |
with=$(cat -vet $i | wc -c) | |
echo -n "chars including special chars in: $i " | |
echo "$with - $without" | |
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
#!/bin/bash | |
rand=$RANDOM | |
const=$((1 + rand % 100)) | |
yellow="\033[33;40m" | |
none="\033[0m" | |
function game { | |
echo -e $yellow"Welcome to the guessing game!"$none | |
echo |
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 | |
# | |
# example usage | |
# | |
# > random_password 10 | |
if [ $# -lt 1 ]; then | |
echo "This command requires an integer for the password length" | |
else | |
echo -n "password: "; base64 /dev/urandom | head -c $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
SELECT relname, last_vacuum, last_autovacuum, last_analyze, last_autoanalyze | |
FROM pg_stat_all_tables | |
WHERE schemaname = 'public'; |
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
--------r u b y | |
require 'csv' | |
require 'faker' | |
CSV.open("./users.csv", 'a+', write_headers: false) do |csv| | |
50_000.times do |n| | |
csv << [n, Faker::FunnyName.two_word_name, Faker::Internet.email, Faker::Address.city] | |
end |