- pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Delete virtual environmnet directory and install a new venv with a proper (brew installed) interpreter as the base.
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
| # XML - get a value using xmlint with xpath the @something (in this case "@string" is an attribute selector | |
| xmllint --xpath "string(//Project/stuff/stuff/Stuff/@string)" some-data.pretty.xml | less | |
| #Select by node index | |
| xmllint --xpath "string(//Project/stuff/stuff[2]/Stuff/@string)" some.pretty.xml | less | |
| # get password for MacOs keycahin assuming that the item is called foobar and the 'account' values is the same as the logged in user | |
| MYPASSWORD=`security find-generic-password -a ${USER} -s foobar -w` | |
| #Pretty print xml |
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
| export const roundWholeNumber = (_num, _places) => { | |
| const num = String(_num) | |
| const places = String(_places) | |
| if (isNaN(parseInt(num)) || isNaN(parseInt(places))) { | |
| return | |
| } | |
| if (places.length > num.length) { | |
| return |
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 a heredoc of the command you want to run, run and assign outout to a variable | |
| getfiles=`sftp me@myhost.com <<GETF | |
| ls | |
| bye | |
| GETF` | |
| # Execute command and filter output, quote output to preserve new lines, this assumes all files desired are prefixed foobar_ | |
| filelist=`echo "$getfiles"|grep 'foobar_'` | |
| ( |
Example :
python ipa_cert_checker.py /Users/janedoe/Documents/Foobar.ipa /Users/janedoe/Documents/barfoo.cer
If any matching certs are found, the script will print something similar to:
Certificate (1) beginning: XCVBNM... matches the specified certificate: /Users/janedoe/Documents/barfoo.cer
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
| # image to base 64 | |
| from PIL import Image | |
| import numpy as np | |
| image = Image.open('~/some.image.png') | |
| image_array = np.array(image) | |
| image_data = base64.binascii.b2a_base64(image_array).decode('ascii') |
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
| { | |
| "name": "Ryan might be Drake", | |
| "description": "He could be you be the judge.", | |
| "data": [{ | |
| "title": "I Think My Brother Might be Drake", | |
| "description": "This conspiracy theory may seem far fetched, but I have 30 reasons (of varying credibility) for thinking that my brother might be Drake.", | |
| "image": "default", | |
| "comment": "A studio portrait of Ryan as a kid.", | |
| "hideNumber": true | |
| }, { |
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
| { | |
| "id": 42, | |
| "name": "Stereotypes", | |
| "description": "A bingo game for TV stereotypes", | |
| "boardSize": 9, | |
| "data": [ | |
| { | |
| "name": "Alpha", | |
| "description": "Buddy Love", | |
| "emoji": "π", |
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
| # in algebra we learn y = m * x + b | |
| # In python that would look like this | |
| import math | |
| def linear(m, x, b): | |
| return m * x + b | |
| # A function takes inputs, processes them and returns a a single item. | |
| # This single item can be a numeric, a string, or something liek a dictionary or tuple | |
| # in some advanced cases a function returns another function (we aint' goin' there)! |
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
| // Splits an array into equal sized chunks | |
| Array.prototype.chunk = function(pieces) { | |
| pieces = pieces || 2; | |
| var len = this.length; | |
| var mid = (len/pieces); | |
| var chunks = []; | |
| var start = 0; | |
| for(var i=0;i<pieces;i++) { | |
| var last = start+mid; | |
| if (!len%pieces >= i) { |