This file contains 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
#!/bin/python3 | |
import requests | |
from bs4 import BeautifulSoup | |
from urllib.request import urlopen | |
#number of results per page | |
num = "500" | |
# query - site:github.com and (/blob/master "navigator.sendBeacon") and (MIT|Apache|GPL|BSD) |
This file contains 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
#!/bin/python3 | |
def checkPal(string, i, j): | |
length = j-i+1 | |
while string[i] == string[j] and i <= j: | |
# 5 , 6 | |
i+=1 | |
j-=1 | |
# 6 , 5 | |
if i == j or i + 1 == j: |
This file contains 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
#!/bin/python3 | |
def generateMinesweeper(gridSize, mines): | |
# lets setup the board | |
board = [] | |
for i in range(gridSize): | |
board.append(['x']*gridSize) | |
# trigger all the mines | |
for mine in mines: |
This file contains 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
#!/bin/bash | |
import math | |
import re | |
# There are a couple of solutions here, one that can be easily stepped through to understand the | |
# process and allows for error checking to be introduced easily, the other a one liner just because | |
# it's what the cool kids seem to be doing. | |
def zerosEndingFactorial(n): | |
total = 1 |
This file contains 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
#!/bin/python3 | |
def subarraySum(arr, n): | |
arr_len = len(arr) | |
count = 0 | |
for x in range(0, arr_len - 1): | |
total = arr[x] | |
for y in range(x+1, arr_len): | |
total += arr[y] | |
if total == n: |
This file contains 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
#!/bin/python3 | |
# Take an ip string and return a string representing it's binary value | |
# inputs: ip_string = '192.168.1.12' | |
# outputs: returns '1100000010...' | |
def prepBinary(ip_string): | |
binary_string = "" | |
ip_nums_string = ip_string.split("."); | |
for ip_num in ip_nums_string: |
This file contains 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
def translateShift2(text): | |
crypt = "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?" | |
print("".join(list(map(lambda a : " " if a==" " else crypt[crypt.index(a)-1], text)))) | |
translateShift2(";p; epe") | |
translateShift2("vtsmnrttu") |
This file contains 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
#!/bin/bash | |
import sys | |
pattern = [ | |
[" ", "+","-","+"], #top row | |
[" ", "/", " ", "/", " ", "|"], # lid rows (many) | |
["+", "-", "+", " ", "|"], # top face | |
["|", " ", "|", " ", "|"], # front and side rows (many) | |
["|", " ", "|", " ", "+"], # pivot to bottom rows | |
["|", " ", "|", " ", "/"], # front and bottom rows (many) |
This file contains 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
#!/bin/python3 | |
import sys | |
def arrow(direction, number): | |
start = -1 | |
# start going left | |
finish = number+1 | |
modifier = 1 #controls direction | |
counter = 0 |