Skip to content

Instantly share code, notes, and snippets.

View nick3499's full-sized avatar
🏠
Working from home

nick3499 nick3499

🏠
Working from home
  • USA
View GitHub Profile
@nick3499
nick3499 / app.py
Last active October 19, 2021 06:47
Python 3: Get astronomy data from IPGeolocation’s Astronomy API: requests, json, pendulum
#!/bin/python3
'''Get data from IPGeolocation’s Astronomy API.'''
from json import loads
from requests import get
from pendulum import parse
# API key
API_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
# geolocation
LATITUDE = '40.713'
@nick3499
nick3499 / scraper.py
Last active October 16, 2021 01:41
Python 3: Scrape weather data from Dark Sky: requests, BeautifulSoup, pendulum
#!/bin/python3
'''Scrape Dark Sky website for weather data.'''
import requests
from bs4 import BeautifulSoup
import pendulum
# source website
URL = 'https://darksky.net/forecast/40.7127,-74.0059/us12/en'
# browser header
headers = {
@nick3499
nick3499 / dec_bin_oct_hex_ascii_chart.py
Last active September 8, 2021 13:58
Python: Decimal, Binary, Octal, Hex, ASCII Conversion Chart: hash table, color formatting, f-strings
#!/bin/python3
'''Decimal/Binary/Octal/Hex/ASCII Conversion Chart'''
def generate_chart():
'''Generate ASCII conversion chart.'''
# decimal keys with standard ASCII symbols
ascii_symbols = {
0: 'NUL', 1: 'SOH', 2: 'STX', 3: 'ETX', 4: 'EOT', 5: 'ENQ', 6: 'ACK',
7: 'BEL', 8: 'BS', 9: 'HT', 10: 'LF', 11: 'VT', 12: 'FF', 13: 'CR',
14: 'SO', 15: 'SI', 16: 'DLE', 17: 'DC1', 18: 'DC2', 19: 'DC3',
@nick3499
nick3499 / kitty_terminal.md
Last active September 5, 2021 18:03
Kitty GPU-based terminal markdown file for application specific use

Kitty (GPU-based terminal emulator)

this document is for application-specific use

Install

$ sudo apt install kitty

Custom Configuration

@nick3499
nick3499 / radio_streams_player.sh
Last active December 8, 2022 04:43
Bash: Radio Streams Player: terminal app, play radio streams, declare associative array, FFplay, MPV, VLC
#!/bin/bash
declare -A STATION
STATION[$(printf "\e[38;2;255;160;0mDEF CON [SomaFM]\e[38;2;0;95;255m mid-tempo >> downtempo >> chill-out >> chillstep >> electro-soul >> ambient\e[0m")]='http://ice3.somafm.com/defcon-128-aac'
STATION[$(printf "\e[38;2;255;160;0mBlack Rock FM [SomaFM]\e[38;2;0;95;255m dark ambient >> desert electronic\e[0m")]='http://ice3.somafm.com/brfm-128-aac'
STATION[$(printf "\e[38;2;255;160;0mSynphaera [SomaFM]\e[38;2;0;95;255m modern electronic >> ambient >> space\e[0m")]='http://ice2.somafm.com/synphaera-128-aac'
STATION[$(printf "\e[38;2;255;160;0mDrone Zone [SomaFM]\e[38;2;0;95;255m ambient >> space\e[0m")]='http://ice2.somafm.com/dronezone-128-aac'
STATION[$(printf "\e[38;2;255;160;0mDeep Space One [SomaFM]\e[38;2;0;95;255m ambient >> space\e[0m")]='http://ice2.somafm.com/deepspaceone-128-aac'
STATION[$(printf "\e[38;2;255;160;0mSpace Station Soma [SomaFM]\e[38;2;0;95;255m downtempo >> space\e[0m")]='http://ice5.somafm.com/spacestation-128-aac'
STATION[$(printf "\e[38;2;255;160;0mSF
#!/bin/python3
'''Use netcat to get list of ports numbers.'''
def get_ports():
from os import system
system("nc mercury.picoctf.net 22902 > ports.txt &")
if __name__ == '__main__':
@nick3499
nick3499 / pictograms_to_picoctf_key.py
Created August 11, 2021 00:57
Python3: Translate Encoded Pictograms to picoCTF Key: urllib.request.urlopen(); read(); decode(); ascii()
#!/bin/python3
'''Translate encoded pictograms to picoCTF key.'''
import urllib.request
with urllib.request.urlopen('https://mercury.picoctf.net/static/\
0d3145dafdc4fbcf01891912eb6c0968/enc') as f:
decoded = f.read().decode('utf-8')
key = ''
for i in range(0, len(decoded)):
@nick3499
nick3499 / find-hidden-key-cat-jpg.sh
Created August 10, 2021 02:56
Shell: exiftool, wget, cut, base64
#!/bin/zsh
# Get `cat.jpg` file and find the kidden key
#
# have only been able to get this to work inside the same directory where
# `exiftool` was installed
# in other words, both the `cat.jpg` file and this script must be
# stored in the `exiftool` directory for this to work
#
# get the `cat.jpg` file from picoctf.net
sudo wget https://mercury.picoctf.net/static/7cf6a33f90deeeac5c73407a1bdc99b6/cat.jpg
@nick3499
nick3499 / decode-rot13.py
Last active August 6, 2021 17:26
Python3: Decode ROT13-Encoded String: regex, ord(), chr()
#!/bin/python3
'''Decode picoGym flag based on ROT13 cypher.'''
import re
def decode_rot13(s: str) -> str:
'''Decode string.'''
decode = ''
for char in s:
if ord(char) > 64 and ord(char) < 78:
@nick3499
nick3499 / spoof_mac_address.py
Created June 10, 2021 13:25
Python 3: Spoof MAC Address: random.randint(), random.choice(), subprocess.run()
#!/usr/bin/python3
'''Spoof MAC address. (as a cybersecurity enhancement)'''
from random import randint
from random import choice
from subprocess import run
# pseudo-randomly generated MAC address
mac_addr = f"{hex(choice(range(16, 255, 2)))[2:]}:\
{hex(randint(16, 256))[2:]}:\
{hex(randint(16, 256))[2:]}:\