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
# README: | |
# | |
# Run this script as follows: | |
# | |
# ./video.sh urls.txt videos | |
# | |
# Where urls.txt is a list of RTSP links | |
# and videos is the directory that you would | |
# like to save the downloaded videos to. If | |
# the designated directory does not exist, it |
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 java.util.stream.IntStream; | |
class Threads { | |
public static void main(String... args) { | |
IntStream | |
.range(0, 10) | |
.mapToObj(i -> new Thread(() -> System.out.println(Thread.currentThread().getName()))) | |
.forEach(thread -> thread.start()); |
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 java.util.concurrent.ThreadLocalRandom; | |
import java.util.Arrays; | |
/** | |
* Quicksort implementation that counts that | |
* number of comparisons required to perform the sort. | |
* | |
* @author Jabari Dash | |
*/ | |
public class QuickSort { |
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 math | |
import random | |
#------------------------------------------------------------------------------- | |
''' | |
Default comparator that sorts | |
numeric values in their natural order. | |
''' | |
def comparator(one, two): |
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
/** | |
* Sorts an array of values. An optional 2 parameter comparator function is available | |
* to specify ordering. If no comparator is supplied, then the values will be sorted | |
* based on their primitive values via the Object.prototype.valueOf() function. | |
*/ | |
function sort(array, comparator = (a, b) => a.valueOf() - b.valueOf()) { | |
quicksort(array, 0, array.length-1, comparator) | |
} | |
//------------------------------------------------------------------------------ |
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 java.util.List; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Objects; | |
import java.util.stream.Collectors; | |
public class Contains { |
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 main | |
import "fmt" | |
import "strconv" | |
//------------------------------------------------------------------------------ | |
type Node struct { | |
data int |
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
#!/usr/lib/python | |
# -*- coding: utf-8 -*- | |
# | |
# This is a re-implementation of Python's timsort in Python | |
# itself. This is purely for learning purposes. :) | |
# References: [ | |
# https://en.wikipedia.org/wiki/Timsort, | |
# http://wiki.c2.com/?TimSort | |
# ] | |
# |
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
public class ToBinary { | |
/** | |
* Converts a positive integer to binary. | |
* | |
* @param decimal Decimal number. | |
* @return Binary string. | |
*/ | |
public static String binary(int decimal) { |
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
var detectBackOrForward = function(onBack, onForward) { | |
hashHistory = [window.location.hash]; | |
historyLength = window.history.length; | |
return function() { | |
var hash = window.location.hash, length = window.history.length; | |
if (hashHistory.length && historyLength == length) { | |
if (hashHistory[hashHistory.length - 2] == hash) { | |
hashHistory = hashHistory.slice(0, -1); | |
onBack(); |