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/bash | |
LOGFILE=/tmp/gcc_install.log | |
# $1 - package name | |
errorIf(){ | |
if [ $? -ne 0 ]; then | |
echo "Something was wrong with $1" | |
exit 1 | |
fi |
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
Python 2.7.9 (2.5.1+dfsg-1~ppa1+ubuntu14.04, Mar 27 2015, 19:19:42) | |
[PyPy 2.5.1 with GCC 4.8.2] | |
Using arena file: | |
example_benchmarks/zeros.py | |
- zeros_imul | |
- zeros_mul | |
- zeros_repeat | |
- zeros_slow | |
Using benchmark file: |
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
#include <stdio.h> | |
#include <ctype.h> | |
#include <string.h> | |
#include <stdlib.h> | |
int is_pal(char* word) { | |
size_t len = strlen(word); | |
char* begin = word; | |
char* end = word + len - 2; // -2 beacuse we get the newline char as well | |
if (len == 1) { |
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/bin/python | |
from subprocess import check_output | |
import sys | |
class Colors: | |
HEADER = '\033[95m' | |
OKBLUE = '\033[94m' | |
OKGREEN = '\033[92m' | |
WARNING = '\033[93m' |
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
mkfifo fifo | |
wireshark -k -i fifo & | |
while true; do ssh MACHINE_IP 'tcpdump -s 0 -U -n -w - "! arp && host 10.0.0.1"' > fifo; done |
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
#include <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
/* | |
* Function used to compare version c strings like: "1.2.3" or "12.9.1314214" | |
*/ | |
int compare_versions(char* first, char* second) | |
{ | |
size_t first_last_dot1 = 0; |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <assert.h> | |
typedef struct node | |
{ | |
int val; | |
struct node* next; | |
} node; |
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
int fib(int term, int val = 1, int prev = 0) | |
{ | |
if(term == 0) return prev; | |
if(term == 1) return val; | |
return fib(term - 1, val+prev, val); | |
} |
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 fib_to(n): | |
fibs = [0, 1] | |
for i in range(2, n+1): | |
fibs.append(fibs[-1] + fibs[-2]) | |
return fibs |
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
mkfifo fifo | |
TCPHOST="10.0.0.1"; while true ; do \ | |
ssh $TCPHOST 'tcpdump -s 0 -U -n -w - "!igmp && !arp && !rarp && !(host 224.0.0.1) && !(port 22) && !(port 67) && !(port 53) && !(port 123) && !(port 5353) && !(port 137)"' > fifo; \ | |
done | |
# on another console | |
wireshark -k -i fifo |