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 / convert2numerology.py
Last active July 14, 2023 00:32
Python 3: Convert Letters to Pythagorean Numerology Values
#!/usr/bin/python3
# text input
txt = list(input('Enter text: ').upper())
# first title
print('---------------')
print('Pythagorean')
print('---------------')
# key value pairs of letters with their associated numbers (Pythagorean)
nums = {
'A': 1, 'B': 2, 'C': 3, 'D': 4, 'E': 5, 'F': 6, 'G': 7, 'H': 8, 'I': 9,
@nick3499
nick3499 / cpu_vuln_info.py
Last active December 18, 2019 07:51
Python 3: CPU Vulnerability Info: os.listdir(), subprocess.run()
#!/usr/bin/env python3
from os import listdir
from subprocess import run
def cpu_vuln_info():
print('\x1b[1;96m===== Vulnerabilities =====\x1b[0m')
vulns = listdir("/sys/devices/system/cpu/vulnerabilities/")
for vuln in vulns:
@nick3499
nick3499 / psych_muse_links.py
Last active December 3, 2019 07:15
Python3: Music Links: tizonia, subprocess, input, for loop, dict
@nick3499
nick3499 / mac_gen.py
Last active December 2, 2019 20:25
Python 3: Pseudo-Random MAC Generator: random, randrange, subprocess
#!/usr/bin/python3
# random mac address generator --> aa:f4:25:c5:0e:2e
from random import randrange as rr
import subprocess
# Organizational Unique Identifier list
oui = [
"F4:BD:9E", "94:E6:F7", "40:55:82", "A4:E3:1B", "98:E7:43", "4C:1D:96",
"10:32:7E", "30:FB:B8", "68:DB:F5", "24:46:C8", "44:D7:91", "84:46:FE",
@nick3499
nick3499 / container_attrib.py
Created October 20, 2019 21:51
PyLXD: Get LXD Container Attributes
#!/usr/bin/python3
# used Python 3.6.8 to access LXD container attributes
from pylxd import Client
client = Client()
container = client.containers.all()[0]
print(f'\033[36;1marchitecture\033[0m')
print(f'{container.architecture}')
@nick3499
nick3499 / brew.js
Created May 13, 2019 07:20
JavaScript: Brew: Date(), getDay(), Intl.DateTimeFormat, Date.now()
#!/usr/bin/node
const brew = n => {
const wkDayNum = new Date().getDay();
const wkDayName = new Intl.DateTimeFormat('en-US', { weekday: 'long' }).format(Date.now());
o = { '0': ['8', '28'], '1': ['6', '20'], '2': ['8', '14'], '3': ['6', '6'],
'4': ['6', '48'], '5': ['8', '42'], '6': ['6', '34'] };
return `${wkDayName}\nbrew: ${o[wkDayNum][0]}\nremain: ${o[wkDayNum][1]}`;
};
console.log(brew());
@nick3499
nick3499 / extended_weekends.js
Created May 5, 2019 23:28
JavaScript: Extended Weekends; Date(), getDate(), getMonth(), getDay()
const solve = (y1, y2) => {
let c = 0;
let m1 = [];
let m2 = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
for (let i = 0; i < (y2 - y1 + 1) * 12; i++) {
d1 = new Date(y1, i, 1);
d2 = new Date(y1, i + 1, 0);
if (d1.getDay() === 5 && d2.getDate() === 31) {
m1.push(d1.getMonth());
c++;
@nick3499
nick3499 / convert2nato.py
Last active July 3, 2024 22:43
Translate to NATO Phonetic Alphabet: JavaScript, Python, Ruby
#! /bin/python3
'''Convert letters to NATO phonetic alphabet.'''
_INPUT = input('Enter letters: ')
def convert_nato():
d = {
'A': 'Alpha', 'B': 'Bravo', 'C': 'Charlie',
@nick3499
nick3499 / encryptLeet.js
Last active March 29, 2019 09:03
Encrypt String: JavaScript, Python
const toLeetSpeak = s => {
h = {
A: '@', B: '8', C: '(', D: 'D', E: '3', F: 'F', G: '6', H: '#', I : '!',
J: 'J', K: 'K', L: '1', M: 'M', N: 'N', O: '0', P: 'P', Q: 'Q', R : 'R',
S: '$', T: '7', U: 'U', V: 'V', W: 'W', X: 'X', Y: 'Y', Z: '2'
}
return s.split('').map(x => h[x] || x).join('')
}
@nick3499
nick3499 / curry.js
Last active March 6, 2019 21:29
JavaScript ES6: Currying
const sum = x => y => z => x+y+z
console.log(sum(1)(2)(3)) // 6