COMPUTER LITERACY
===================
Revision Notes
Final Examination
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
##################################################################################################### | |
# Copyright (c) 2023-2024 NWSOFT # | |
# # | |
# Permission is hereby granted, free of charge, to any person obtaining a copy # | |
# of this software and associated documentation files (the "Software"), to deal # | |
# in the Software without restriction, including without limitation the rights # | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # | |
# copies of the Software, and to permit persons to whom the Software is # | |
# furnished to do so, subject to the following conditions: # | |
# # |
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
MIT License | |
Copyright (c) 2024 Andy Zhang | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
NAMES = { | |
2: "binary", | |
3: "trinary", | |
4: "quaternary", | |
8: "octadecimal", | |
10: "decimal", | |
16: "hexadecimal" | |
} | |
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
Show hidden characters
// A File Icon Preferences – User | |
// ================================================================ | |
{ | |
"color": "hsl(219, 28%, 88%)", | |
"color_on_hover": "hsl(0, 0%, 97%)", | |
"color_on_select": "hsl(0, 0%, 100%)" | |
} |
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 random | |
def shuffle(ary): | |
old_ary = ary[:] | |
a = len(ary) | |
b = a - 1 | |
for d in range(b, 0, -1): | |
e = random.randint(0, d - 1) | |
ary[d], ary[e] = ary[e], ary[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
#!/bin/bash | |
# Cloudflare as Dynamic DNS | |
# From: https://letswp.io/cloudflare-as-dynamic-dns-raspberry-pi/ | |
# Based on: https://gist.github.com/benkulbertis/fff10759c2391b6618dd/ | |
# Original non-RPi article: https://phillymesh.net/2016/02/23/setting-up-dynamic-dns-for-your-registered-domain-through-cloudflare/ | |
# Update these with real values | |
auth_email="email@example.com" | |
auth_key="global_api_key_goes_here" | |
zone_name="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
// It turns out people don't really know how to handle Alt+ch, or F[1, 12] keys | |
// etc. in ncurses apps. Even StackOverflow is full of wrong answers and ideas. | |
// The key idea is to skip ncurses' key handling and read stuff from the stdin | |
// buffer manually. Here's a demo. Run this and start typing. ESC to exit. | |
// | |
// To compile: | |
// | |
// $ gcc demo.c -o demo -lncurses -std=gnu11 | |
#include <ncurses.h> |
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 <iostream> | |
#include <chrono> | |
#include <future> | |
#include <string> | |
std::string GetLineFromCin() { | |
std::string line; | |
std::getline(std::cin, line); | |
return line; | |
} |
NewerOlder