# get the diff between current head and master
git-changed-files-and-lines.py master
# get the diff between master and dev
git-changed-files-and-lines.py master dev
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
| # Rotates the given homography from the origin point | |
| def getRotatedHomography(homography, size, angle): | |
| width, height = size | |
| rotation = cv2.getRotationMatrix2D((width / 2, height / 2), angle, 1) | |
| rotationHomography = np.concatenate((rotation, np.array([[0, 0, 1]]))) | |
| return np.dot(rotationHomography, homography) |
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
| class MyPromise{ | |
| // create a new instance of a promise | |
| // callback is a function that accepts resolve and reject functions as params | |
| constructor(callback){ | |
| this.resolved = false; | |
| this.reject = false; | |
| this.value = null; | |
| // to temporarily hold promises that got created while this promise was in pending state | |
| this.waiting = []; |
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
| import { AES, TripleDES, lib, mode, CipherOption, Cipher } from 'crypto-js'; | |
| import { BinaryFormatter, wordArrayToUint8Array } from './utils'; | |
| export enum EncryptionAlgorithm{ | |
| AES = 0, | |
| TripleDES = 1, | |
| } | |
| //const options = { padding: pad.ZeroPadding, mode: mode.CBC }; | |
| const options = { | |
| [EncryptionAlgorithm.TripleDES]: { |
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
| function doSomething(){ | |
| return Promise.resolve(73); | |
| } | |
| function timeout(ms){ | |
| return new Promise((resolve) => setTimeout(resolve, ms, ms)); | |
| } | |
| function asyncFlow(generatorFunc){ | |
| const generator = generatorFunc(); |
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
| // Previous approach to conversion | |
| // definition | |
| def rowToDocument(row: Row): BsonDocument | |
| // usage | |
| rowToDocument(row) // for each line | |
| // The (micro) optimized approach | |
| // definition | |
| def rowToDocumentMapper(schema: StructType): (Row) => BsonDocument | |
| // usage |
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
| import org.apache.spark.sql.types._ | |
| import org.apache.spark.sql.functions._ | |
| case class Order(id: String, userName: String) | |
| val orders = Seq(Order("5b85bda7685ca053517a948b", "Ahmet"), Order("5b85bda764d8194a675a546d", "Mehmet"), Order("5b85bda812c1e568bc6596dc", "Ahmet")).toDS() | |
| orders | |
| .groupBy("userName") | |
| .agg( | |
| first(struct($"id" as "oid")) as "firstOrder", |
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
| version: '3' | |
| networks: | |
| face-network: {} | |
| volumes: | |
| database-storage: {} | |
| services: | |
| database: | |
| build: ./persistence/database | |
| volumes: | |
| - database-storage:/data/db |
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
| # git commit with branch helper | |
| gam () { | |
| MESSAGE="$1" | |
| TASK_ID=$(git branch | grep \* | cut -d ' ' -f2 | perl -l -ne '/[a-z]+\/([A-Z]+\-[0-9]+)($|=)/ && print $1') | |
| if [ -z "$TASK_ID" ]; then | |
| echo "task id not be found. branch examples: feature/RECO-01, feature/RECO-01=long-description" | |
| echo "falling back to normal commit" | |
| git commit -am "$MESSAGE" | |
| elif [ -z "$MESSAGE" ]; then |
- Writing clean code is like riding a bike, you can study physics of it, but still fall down the first time you try to do it
- Programming languages will be created with higher abstractions, and more specific languages related to domains we work will be created(a+), but that doesn’t mean programming will be a lost art. We can’t create machines that do what we want. We can only create machines that can do what we say.
- Leblanc’s law: later equals never