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
import PIL | |
from PIL import Image | |
import os | |
for x in os.listdir("./"): | |
try: | |
img = Image.open(x) | |
w, h = img.size | |
new_img = img.crop((100, 100, w-200, h-30)) | |
new_img.save(x) |
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
/* | |
* Simple demonstration | |
* 1) Increase resistance of potentiometer. | |
* 2) Buzzer increase in loudness | |
* 3) When we reach max loudness led turns on | |
*/ | |
// Pins used | |
const int led = 12; |
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
""" | |
gen adjacency matrix | |
edge rule = {{v_i, v_j} | i - j === 1 or -1 or 2 or -2 (mod 9)} | |
Format | |
1 2 3 4 ... | |
1 | |
2 | |
3 |
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
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <sys/ioctl.h> | |
#include <netinet/in.h> |
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
""" | |
Simple firebase script without authentication | |
Only use for debugging or testing purposes | |
""" | |
import json | |
from urllib.request import Request, urlopen, build_opener, HTTPHandler | |
from urllib.error import URLError, HTTPError | |
class Firebase(): |
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
Sub PasswordBreaker() | |
Dim i As Integer, j As Integer, k As Integer | |
Dim l As Integer, m As Integer, n As Integer | |
Dim i1 As Integer, i2 As Integer, i3 As Integer | |
Dim i4 As Integer, i5 As Integer, i6 As Integer | |
On Error Resume Next | |
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66 |
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
import random | |
# As the grammar doesn't handle divide by 0, such functions cannot be evaluated | |
# properly | |
def calculator(input_string): | |
""" | |
Input a string with valid grammer to calculate result | |
We will use the following grammar |
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
import random | |
""" | |
Using an unbiased 6 sided die | |
What is the probability that you will roll a 4 at | |
least once if you roll six times? | |
P(At Least a 4) = P(Total) - P(Not a 4)^6 | |
P(At Least a 4) = 1 - (5/6)^6 |
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
/* | |
* ===================================================================================== | |
* | |
* Filename: complex.c | |
* | |
* Description: Implementation of program that supports accepting two complex numbers from the user; adding, subtracting, multiplying, and dividing them; reporting each result to the user | |
* | |
* Version: 1.0 | |
* Created: 02/08/2018 10:12:01 PM | |
* Revision: none |
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
""" | |
Add file name to the bottom of pdf page using python | |
""" | |
from PyPDF2 import PdfFileWriter, PdfFileReader | |
import io | |
from reportlab.pdfgen import canvas | |
from reportlab.lib.pagesizes import letter | |
import os | |
import sys |