Skip to content

Instantly share code, notes, and snippets.

View AWRyder's full-sized avatar

João Braz AWRyder

  • blue-infinity
  • Leiria, Portugal
View GitHub Profile
import sys
import hashlib
import requests
hash_object = hashlib.sha1(sys.argv[1].encode('utf-8'))
hex_dig = hash_object.hexdigest()
print('Hex: '+hex_dig)
print('First 5 chars: '+hex_dig[:5])
response = requests.get('https://api.pwnedpasswords.com/range/'+hex_dig[:5])

Regex Fundamentals

What is RegEx?

A regular expression is a string of characters which can help us find, extract or replace information inside a text file.

In RegEx everything is a character and we are writting a pattern to find a specific sequence of characters.

Some examples could be:

  • Finding a specific pattern in a text file or a source code file;

Keybase proof

I hereby claim:

  • I am AWRyder on github.
  • I am awkens (https://keybase.io/awkens) on keybase.
  • I have a public key whose fingerprint is 394A 483D E206 66C2 DB48 FCFC 1A79 7C33 1B4F 7550

To claim this, I am signing this object:

@AWRyder
AWRyder / promises-example.js
Created March 1, 2018 15:10
Example of promises for flow control of async rest requests
var axios = require('axios');
var cardAxios = axios.create({
baseURL: 'https://deckofcardsapi.com/api/',
timeout: 50000
});
cardAxios.get('deck/new/shuffle/?deck_count=1')