Skip to content

Instantly share code, notes, and snippets.

View lopezm1's full-sized avatar
💭
🤔

Miguel Lopez lopezm1

💭
🤔
View GitHub Profile
@lopezm1
lopezm1 / bubblesort.py
Last active May 20, 2018 21:48
bubblesort
# Let's bubblesort
def swap(a, b):
return b, a
def bubblesort(numbers):
length = len(numbers)
swapped = True
@lopezm1
lopezm1 / triplet-sums.py
Created May 19, 2018 22:22
Given an array of distinct integers and a sum value. Find count of triplets with sum smaller than given sum value.
import os
from itertools import combinations
#Given an array of distinct integers and a sum value. Find count of triplets with sum smaller than given sum value.
"""
Input : arr[] = {-2, 0, 1, 3}
sum = 2.
Output : 2
Explanation : Below are triplets with sum less than 2
@lopezm1
lopezm1 / palindrome.py
Created May 19, 2018 21:49
Palindrome?
import location
import os
# function which return reverse of a string
def reverse(s):
return s[::-1]
def isPalindrome(theString):
flip = reverse(theString)
@lopezm1
lopezm1 / flip-string-without-specials.py
Created May 19, 2018 21:27
Given a string S, containing special characters and all the alphabets, reverse the string without affecting the positions of the special characters.
import location
import os
#Given a string S, containing special characters and all the alphabets, reverse the string without affecting the positions of the special characters.
def flipString(theString):
holdThese = ""
listChars = list(theString)
@lopezm1
lopezm1 / brew-install-mac-dev-environment.sh
Last active June 11, 2020 05:30
Brew Install My Dev Environment for macOS High Sierra - Slack, Docker, iTerm, IntelliJ, Google, SourceTree, Spotify, etc.
#!/bin/bash
APP_FOLDER_LOCATION=/Applications
IFS=""
## Install applications via brew cask
brew_install() {
execute="$(brew cask install $1 2>&1)"
case $execute in
*Warning*|*Error*) echo "Warning while installing $1: $execute" ;;
*successfully*) echo "$execute \n Installed $1." ;;
@lopezm1
lopezm1 / ddl.sql
Last active August 29, 2015 14:11
SQL Database -- Practice using function calls and query calls
/*
** ----------------------------------------------------------------------------
** script to create the employee table
** --------------------------------------------------------------------------*/
CREATE TABLE employee (
fName VARCHAR2(20)NOT NULL,
mInit CHAR(1),
lName VARCHAR2(20) NOT NULL,