This file contains hidden or 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
| #!/usr/bin/env python3 | |
| from cryptography.hazmat.backends import default_backend | |
| from cryptography.hazmat.primitives import hashes, serialization | |
| from cryptography.hazmat.primitives.asymmetric import ec | |
| from cryptography.exceptions import InvalidSignature | |
| from hexdump import hexdump | |
| DATA = b"""SHORT DATA, FOR LONG DATA, HASH INTO DIGEST FIRST""" | |
| private_value = "FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00" |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| from prometheus_client import CollectorRegistry, Gauge, write_to_textfile | |
| from psutil import process_iter | |
| from socket import gethostname | |
| hostname = gethostname() | |
| pid_count = {} | |
| for proc in process_iter(['pid', 'name', 'username']): | |
| if proc.info['username'] not in pid_count: |
This file contains hidden or 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
| docker run \ | |
| -d --rm \ | |
| -v /etc/sumologic-prometheus-scraper/config.json:/config.json \ | |
| -e CONFIG_PATH='/config.json' \ | |
| --network=prometheus \ | |
| --name=sumologic-prometheus-scraper \ | |
| sumologic/sumologic-prometheus-scraper |
This file contains hidden or 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
| docker run \ | |
| -d --rm \ | |
| -v "/proc:/host/proc" \ | |
| -v "/sys:/host/sys" \ | |
| -v "/:/rootfs" \ | |
| --network=prometheus \ | |
| --name=prometheus \ | |
| prom/node-exporter \ | |
| --path.procfs /host/proc \ | |
| --path.sysfs /host/proc \ |
This file contains hidden or 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
| # SSHing into VM instances on GCP | |
| 1. Add your SSH public key to your user account | |
| https://cloud.google.com/compute/docs/instances/managing-instance-access#add_oslogin_keys | |
| $ gcloud compute os-login ssh-keys add --key-file id_rsa.pub | |
| 2. Verify your SSH public key is uploaded | |
| $ gcloud compute os-login describe-profile |
This file contains hidden or 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
| #!/usr/bin/env fish | |
| ykman piv reset | |
| ykman piv access change-management-key -m 010203040506070801020304050607080102030405060708 -P 123456 -p | |
| ykman piv keys generate -P 123456 --touch-policy=always 9a - | |
| ykman piv keys attest 9a /tmp/9acert.pem | |
| ykman piv certificates import -P 123456 9a /tmp/9acert.pem | |
| ykman piv objects generate chuid -P 123456 | |
| ykman piv objects generate ccc -P 123456 | |
| ykman piv access change-puk -p 12345678 -n (openssl rand -base64 6) |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | |
| size = chars.length | |
| begin | |
| pick = Random.rand(size) | |
| place = Random.rand(size) | |
| temp = chars[place] | |
| chars[place] = chars[pick] |
This file contains hidden or 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
| docker run -d --name="home-assistant" -v /etc/home-assistant:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/rpi2-home-assistant |
This file contains hidden or 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
| CREATE TABLE wins ( | |
| win_id INT NOT NULL, | |
| game_id INT NOT NULL, | |
| winner_id INT NOT NULL, | |
| PRIMARY KEY (win_id) | |
| ); | |
| CREATE TABLE games ( | |
| game_id INT NOT NULL, | |
| player_id INT NOT NULL, |
This file contains hidden or 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
| M-SEARCH * HTTP/1.1 | |
| HOST: 239.255.255.250:1900 | |
| MAN: "ssdp:discover" | |
| MX: 15 | |
| ST: urn:Belkin:device:** | |
| M-SEARCH * HTTP/1.1 | |
| HOST: 239.255.255.250:1900 | |
| MAN: "ssdp:discover" | |
| MX: 15 |
NewerOlder