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 unzip_file(self, path): | |
''' | |
Using a file path, unzip the file in to a directory of files returning a list of files in that folder | |
:param path, a string representing the location of the zip file (path/to/zip.zip) | |
:rtype list of files in decompressed folder | |
''' | |
import os | |
import zipfile | |
folder, ext = os.path.splitext(path) | |
if not os.path.exists(folder): |
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
<?php | |
Class CSVHandle | |
{ | |
const CHUNK_SIZE = 4096; | |
private $chunk = []; | |
private $buffer = ''; | |
private $fp = null; | |
/** |
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
<?php | |
/** | |
* Perform an STRIPOS with multiple needles, and optionally filter the result to a bool | |
* @param string $haystack The string to search | |
* @param array $needles The array of needles to hunt for | |
* @param int $offset The offset to start at | |
* @param bool $filter Should we filter the result to a boolean? | |
* | |
* @return mixed |
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
<?php | |
/** | |
* This is tested in PHP 7.1 | |
* As part of a system I'm looking to store a series of hashes, and look these up. | |
* There could be many hashes, and I don't need to use these, I just need to know if they exist. | |
* | |
* The following tests pit arrays against strings to see which is the fastest. | |
* I'll be searching for MTIzNDY5MTI1Njc4 which is the number 12345678 * 1000 base 64 encoded | |
**/ |
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 itertools # we'll need the unique combinations of multiples | |
''' | |
Calculate the sum of all multiples in a given total | |
Divide total by multiples to get the amount of multiples. | |
Then multiply this by the total plus the multiple and divie the result | |
by 2 | |
:param int multiple The multiples to search for |
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
export enum AccountType { | |
USER = 'User', | |
ORGANIZATION = 'Organization' | |
} | |
export interface Account { | |
login: string; | |
id: number; | |
node_id: string; | |
avatar_url: 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
plugins { | |
// Apply the java plugin to add support for Java | |
id 'java' | |
// Apply the application plugin to add support for building a CLI application | |
id 'application' | |
id 'maven-publish' | |
} | |
repositories { |
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
# Given f(x) = x**4 - 3**3 + 2 = f1(x) = 4x**3 - 9**2 | |
# lets start at x = 6 | |
curr_x = 6 | |
gamma = 0.001 | |
precision = 0.0000001 | |
step_size = 1 | |
max_iterations = 1000 | |
i = 0 | |
df = lambda x: (4 * x**3) - (9**2) |
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
name: Publish Docker image | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'docker-example/*' | |
- '.github/workflows/docker-example.yml' |
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
package com.mattamorphic.concurrent.assignment2; | |
import java.util.concurrent.RecursiveAction; | |
import java.util.ArrayList; | |
public class InsertionSortAction extends RecursiveAction { | |
private ArrayList<Integer> list; | |
InsertionSortAction(ArrayList<Integer> list) { | |
this.list = list; |
OlderNewer