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
max_n1, max_n2, max_prod = 0, 0, 0 | |
for n1 in range(100, 1000): | |
for n2 in range(100, 1000): | |
product = str(n2 * n1) | |
if product == product[::-1]: | |
if max_prod < int(product): | |
max_prod = int(product) | |
max_n1 = n1 | |
max_n2 = n2 |
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
package recursion; | |
import cos126.StdDraw; | |
import java.awt.geom.*; | |
import java.lang.Math; | |
public class KochSnowflake | |
{ | |
public static Point2D.Double ref; | |
public static int rotation = 0; |
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 "zombies.h" | |
int *dijkstra(t_graph *graph, int s) { | |
// compute the safest path from starting node s to every other node | |
// safest path means smallest sum of strength on vertices | |
// we don't need to worry about the weight of the edges | |
if(graph != NULL && graph->v > 0) { | |
int p[graph->v]; | |
int d[graph->v]; | |
int paths[graph->v][graph->v]; |
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 "zombies.h" | |
t_graph *prim(t_graph *graph, int s) { | |
t_graph *prim; | |
if(graph != NULL && graph->v > 0 && graph->e > 0) { | |
prim = new_graph(graph->v); | |
unsigned int i; | |
unsigned int j; | |
int visited[graph->v]; | |
int known; |
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/sh | |
EXCLUDE=( Filesystem devtmpfs tmpfs ); | |
USAGE_THRESHOLD=85; | |
PREV_IFS=$IFS; # save the old IFS so we can restore it later | |
IFS="|"; # change the internal field separator to a pipe | |
EX="${EXCLUDE[*]}"; # join exclude partitions with pipe separator | |
IFS=$PREV_IFS; # restore IFS | |
df -h | grep -Ev "^${EX}" | awk '{print $5 " " $1}' | while read output; |
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 | |
HIGHLIGHT="\e[01;34m" | |
NORMAL='\e[00m' | |
find . -name .git -type d -prune | cut -d. -f2 | while read file | |
do | |
STATUS=$(cd .$file; git status); | |
echo -e '\n'${HIGHLIGHT}$file ${NORMAL}'\n\t'$STATUS | |
done |
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 | |
PREV_IFS=$IFS; | |
IFS=$'\n'; | |
HOSTNAME=$(hostname) | |
ERRORS=(); | |
for ip in ${*} | |
do | |
LATENCY=$(ping -c 1 $ip | grep -oEi "time=([0-9.]*)" |awk -F'=' '{print $2}') |
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
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
ZSH_THEME="robbyrussell" | |
# Example aliases | |
# alias zshconfig="mate ~/.zshrc" |
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/env python | |
# -*- coding: utf-8 -*- | |
import os | |
import subprocess | |
import sys | |
import re | |
import argparse | |