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
#!python3 | |
from itertools import product | |
def parseCycle(cycle, n): | |
permutation = [0 for i in range(n)] | |
cycle_start = 0 | |
prev = 0 | |
for i in range(len(cycle)): | |
cur = cycle[i] | |
if cur == cycle_start: |
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
#!/usr/bin/python3 | |
from itertools import permutations | |
#This program checks that there are four and only four numbers in their natural position | |
def checkPmt(pmt, numInPosition = 4): | |
#pmt is a tuple of length n | |
currInPosition = 0; | |
for i,k in enumerate(pmt): | |
if (i+1 == k): currInPosition += 1; |
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
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <functional> | |
#include <random> | |
using namespace std; |
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
#!/bin/bash | |
#set -x | |
DATE=`date +%Y-%m-%d` | |
echo "Log from $DATE" > out.log | |
ENTRIES=8 #TODO: Please change me! | |
#Arrays are separated by spaces! | |
ARRAY=( | |
https://www.youtube.com/playlist?list=PLqKSWM3wXgnrMlice2vo63ZqzqG0LOghw |
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
/* Warmup Questions */ | |
/* Warmup 1: array Length recursive | |
Write a function that takes in the start of the array and the end, | |
and returns the length of the array | |
See test for examples | |
*/ | |
int arrLenRec(int* start, int* end) | |
{ |
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
# Calculates transitive closure of a relation | |
# EECS 203 students: You are FORBIDDEN from using this code | |
# for homework purposes. Only use this for self-learning | |
# and testing. | |
import strutils, sequtils, sugar, strformat | |
type Matrix = seq[seq[bool]] | |
func `$`(m: Matrix): string = | |
for row in m: |
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
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<link href="/static/chartist/chartist.min.css" rel="stylesheet" /> | |
<script src="/static/chartist/chartist.min.js" > </script> | |
<title>Your title here!</title> | |
</head> | |
<body> | |
<h1> Progress chart! </h1> | |
<div class="ct-chart ct-octave"> </div> |
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 os | |
import std/[times, monotimes, stats] | |
from regex import nil | |
from std/re import nil | |
proc measureNimRegex(data, pattern: string) = | |
var r: RunningStat | |
var matches: int | |
let patternRe = regex.re(pattern) | |
for i in 1..3: |
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 replaceHome($pathArray) { | |
# Check whether the first three paths are equal to HOME | |
# If it is, it substitutes it for ~ | |
# Change this accordingly, if your home path is more than three | |
# paths long. | |
$splitChar = [System.IO.Path]::DirectorySeparatorChar | |
if ( ($pathArray.Length -gt 2) -and | |
(($pathArray[0..2] -join $splitChar) -eq $HOME)) { | |
@("~") + $pathArray[3..$pathArray.Length] | |
} |
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
[CmdletBinding(SupportsShouldProcess = $True)] | |
Param ( | |
[Parameter(Mandatory = $true)] | |
[string]$URL, | |
[Switch]$audio, | |
[Switch]$ignoreErrors | |
) | |
$command = $URL, '-o', '%(title)s.%(ext)s' | |
if ($audio) { | |
$command += "-x", "--postprocessor-args", "`"-threads 2`"" |
OlderNewer