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
# written by: https://github.com/beefy | |
# for: https://www.reddit.com/r/math/comments/6tcrxs/3x3_magic_square_of_squares_1000_prize/ | |
import numpy as np | |
while(1): | |
# generate a random 3x3 matrix | |
parker = np.random.randint(1000, size=(3, 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
#include "csapp.h" | |
/* usage: ./echoclient host port */ | |
int main(int argc, char **argv) | |
{ | |
int clientfd, port; | |
char *host, buf[MAXLINE]; | |
rio_t rio; | |
host = argv[1]; | |
port = atoi(argv[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
#!/usr/bin/env bash | |
do_push() { | |
while true; do | |
read -p "ready to push? " yn | |
case $yn in | |
[Yy]* ) read -p "commit msg: " msg; git add . -A; git commit -m "$msg"; git push; break;; | |
* ) kill -INT $$;; | |
esac | |
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
/* $begin csapp.c */ | |
#include "csapp.h" | |
/************************** | |
* Error-handling functions | |
**************************/ | |
/* $begin errorfuns */ | |
/* $begin unixerror */ | |
void unix_error(char *msg) /* unix-style error */ | |
{ |
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/python | |
import spynner | |
import pyquery | |
import urllib | |
import os | |
# author: Nate Schultz | |
# contact: github.com/beefy | |
# created: 10/22/16 |
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 python2.7 | |
# taken from https://www.youtube.com/user/sentdex | |
import time | |
import urllib2 | |
from urllib2 import urlopen | |
from lxml import html | |
sp500short = ['a', 'aa', 'aapl', 'abbv', 'abc', 'abt', 'ace', 'aci', 'acn', 'act', 'adbe', 'adi', 'adm', 'adp'] |
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 | |
# execute `sudo apt-get install texlive-full` to install pdflatex | |
files = [file for file in os.listdir('.') if file.endswith('.tex')] | |
for file in files: | |
os.system('pdflatex '+file) |
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
void setup() | |
{ | |
} | |
void loop() | |
{ | |
digitalWrite(9,HIGH); | |
delay(100); | |
digitalWrite(9,LOW); | |
delay(900); |
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
var socket = require('socket.io-client')('http://127.0.0.1:3000'); | |
socket.on('connect', function(){}); | |
socket.on('event', function(data){}); | |
socket.on('disconnect', function(){}); | |
var readline = require('readline'); | |
var rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
terminal: false |
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
# taken from: | |
# http://stackoverflow.com/questions/22459020/python-decode-utf-16-file-with-bom | |
def decode_legacy(file_name): | |
encoded_text = open(file_name,'rb').read() | |
bom = codecs.BOM_UTF16_LE | |
assert encoded_text.startswith(bom) | |
encoded_text= encoded_text[len(bom):] | |
decoded_text= encoded_text.decode('utf-16le') | |
return decoded_text |