Skip to content

Instantly share code, notes, and snippets.

View Scifideity's full-sized avatar

Scifideity

  • Sol System, 3rd rock from sun, make a left
View GitHub Profile
@nboubakr
nboubakr / subnet.py
Created December 20, 2012 11:23
A simple python script converts a Classless Inter-Domain Routing (CIDR)-formatted IP address into an IP range and netmask.
#!/usr/bin/env python
# python subnet.py 200.100.33.65/26
import sys
# Get address string and CIDR string from command line
(addrString, cidrString) = sys.argv[1].split('/')
# Split address into octets and turn CIDR into int
addr = addrString.split('.')
@jctosta
jctosta / screen_cheatsheet.markdown
Last active July 23, 2024 06:50
Screen Cheatsheet

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@guillaumevincent
guillaumevincent / test_xmldiff.py
Last active April 26, 2023 18:58
compare two XML in python
import json
import unittest
import xmltodict
class XmlDiff(object):
def __init__(self, xml1, xml2):
self.dict1 = json.loads(json.dumps((xmltodict.parse(xml1))))
self.dict2 = json.loads(json.dumps((xmltodict.parse(xml2))))
@ramiabraham
ramiabraham / rom_suffix_codes.md
Last active July 10, 2024 18:56
Video game rom suffix codes (decoded)

Video game rom codes

You wouldn't download a car...


Primary rom codes

Probably what you're looking for

  • [a] Alternate (alternate version of the game, usually trying a different output method)
  • [p] Pirate
@Akendo
Akendo / netmask_to_cidr.py
Created May 24, 2017 11:23
Converting a netmask to CIDR with vanilla python
def netmask_to_cidr(m_netmask):
return(sum([ bin(int(bits)).count("1") for bits in m_netmask.split(".") ]))
@RaceFPV
RaceFPV / add-to-asa-blacklist.py
Created February 5, 2019 16:18
Netmiko python script to add a new ip address to a blacklist group on multiple Cisco ASA firewalls
#!/usr/bin/env python3
#This script assumes there is a network object-group on all Cisco ASAs called 'grp..blacklist', and that the group is attached to the correct ACL/interface
#import all the modules we need
import sys
import os
import netmiko
from netmiko import ConnectHandler
print('imported modules')
@shyamgupta
shyamgupta / login.html
Last active September 13, 2019 19:37
Google Signin
<!-- Google+ API was shutdown on 3/7/2019. New OAuthFlow (listed below) uses the updated Google sign-in. -->
<!--You just need to update this in login.html page for Udacity's Full Stack nanodegree -->
<!-- Below is the Google link I used for reference -->
<!-- https://developers.google.com/identity/sign-in/web/server-side-flow -->
**login.html Page**
(1) Include the following in <head>..</head> tag:
@hakluke
hakluke / grepips.py
Last active April 3, 2022 16:59
Little Python script to dump IP addresses from a file
#!/usr/bin/python3
import sys, re
f = open(sys.argv[1],'r')
text = f.read()
ips = []
regex = re.findall(r'\b(?:\d{1,3}\.){3}\d{1,3}\b',text)
if regex is not None:
for match in regex:
if match not in ips:
@coltenkrauter
coltenkrauter / fix-wsl2-dns-resolution
Last active July 24, 2024 17:10
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@Pr1meSuspec7
Pr1meSuspec7 / check_if_ipv4.py
Last active February 19, 2021 20:59
Function for check if input is an ipv4 address.
def check_if_ipv4(ip):
quad = ip.split(".")
quadinteger = []
try:
quadinteger = [int(num) for num in quad]
except ValueError:
#print('ERROR: Must be an ipv4 address')
return
while len(quadinteger) != 4:
#print('ERROR: Must be four octects')