Skip to content

Instantly share code, notes, and snippets.

View lopezm1's full-sized avatar
💭
🤔

Miguel Lopez lopezm1

💭
🤔
View GitHub Profile
@lopezm1
lopezm1 / github.sh
Created March 31, 2020 20:53
Script used to pull all application changes and repo specific changes. Creates csv files that can be uploaded to an audit.
# /bin/bash
GITHUB_TOKEN="xxxxx"
GITHUB_ORG="your-org-name-here"
APP_CHANGES_FILE="application-changes.csv" # filename for application changes
INFRA_REPO_1="infra-repo-name-1" # infra repo #1
INFRA_REPO_2="infra-repo-name-2" # infra repo #2
INFA_FILE_1="${INFRA_REPO_1}-changes.csv"
INFA_FILE_2="${INFRA_REPO_2}-changes.csv"
@lopezm1
lopezm1 / github.sh
Created March 31, 2020 20:53
Script used to pull all application changes and repo specific changes. Creates csv files that can be uploaded to an audit.
# /bin/bash
GITHUB_TOKEN="xxxxx"
GITHUB_ORG="your-org-name-here"
APP_CHANGES_FILE="application-changes.csv" # filename for application changes
INFRA_REPO_1="infra-repo-name-1" # infra repo #1
INFRA_REPO_2="infra-repo-name-2" # infra repo #2
INFA_FILE_1="${INFRA_REPO_1}-changes.csv"
INFA_FILE_2="${INFRA_REPO_2}-changes.csv"
@lopezm1
lopezm1 / ubuntu_18.04_linking_error.txt
Created September 28, 2018 00:11
Error discovered while compiling uWSGI with poise_python in Ubuntu 18.04
----------------------------------------
Running setup.py clean for uwsgi
Failed to build uwsgi
Installing collected packages: uwsgi
Running setup.py install for uwsgi: started
Running setup.py install for uwsgi: finished with status 'error'
Complete output from command /srv/uwsgi-python2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-wJZ6XX/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-tv1IpV/install-record.txt --single-version-externally-managed --compile --install-headers /srv/uwsgi-python2/include/site/python2.7/uwsgi:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'descriptions'
warnings.warn(msg)
running install
function bubbleSort(arr) {
var hasSwapped = true;
while(hasSwapped){
hasSwapped = false; // attempt to be done
for(var i = 0; i < arr.length - 1; i++){
var tmp;
if(arr[i+1] < arr[i]) { //if value ahead of it is smaller
@lopezm1
lopezm1 / primechecker.js
Created May 20, 2018 21:34
check if a number is a prime number
function primeChecker(n) {
var divisor = 2;
var isPrime = true;
while(n > divisor){
if(n % divisor === 0){
isPrime = false; // not a PRIME!!!
} else {
divisor++;
}
# The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days. For example, if the given array is {100, 180, 260, 310, 40, 535, 695}, the maximum profit can earned by buying on day 0, selling on day 3. Again buy on day 4 and sell on day 6. If the given array of prices is sorted in decreasing order, then profit cannot be earned at all.
def sell(lowidx, highidx):
print("time to sell -------")
print("buy:", lowidx)
print("sell:", highidx)
def stock(arr):
low = None # keep track of lowest value
lowidx = None # keep track of lowest day
# The cost of a stock on each day is given in an array, find the max profit that you can make by buying and selling in those days. For example, if the given array is {100, 180, 260, 310, 40, 535, 695}, the maximum profit can earned by buying on day 0, selling on day 3. Again buy on day 4 and sell on day 6. If the given array of prices is sorted in decreasing order, then profit cannot be earned at all.
def sell(lowidx, highidx):
print("time to sell -------")
print("buy:", lowidx)
print("sell:", highidx)
def stock(arr):
low = None
lowidx = None
@lopezm1
lopezm1 / smallest-subarray-large-than-value.py
Created May 20, 2018 20:06
# Given an array of integers and a number x, find the smallest subarray with sum greater than the given value.
# Given an array of integers and a number x, find the smallest subarray with sum greater than the given value.
"""
arr[] = {1, 4, 45, 6, 0, 19}
x = 51
Output: 3
Minimum length subarray is {4, 45, 6}
"""
save = None
@lopezm1
lopezm1 / prototype.js
Created May 20, 2018 18:21
js prototype
function Animal(animal, noise) {
this.noise = noise;
this.animal = animal;
}
Animal.prototype.makeNoise = function() {
console.log('I\'m a ' + this.animal + ' - ' + this.noise)
}
@lopezm1
lopezm1 / pythagorean.py
Created May 20, 2018 00:10
Given an array of integers, write a function that returns true if there is a triplet (a, b, c) that satisfies a**2 + b**2 = c**2.
from itertools import combinations
# Given an array of integers, write a function that returns true if there is a triplet (a, b, c) that satisfies a2 + b2 = c2.
"""
Input: arr[] = {3, 1, 4, 6, 5}
Output: True
There is a Pythagorean triplet (3, 4, 5).
"""