This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
fun prepend(xs: int list, ys: int list)= | |
if null xs | |
then ys | |
else (hd xs):: prepend( (tl xs), ys); | |
val xs = [4,5,6]; | |
val ys = [1,2,3]; | |
(* [4,5,6, 1,2,3] *) | |
prepend(xs, ys); |
def bad_prepend(xs, ys): | |
if not xs: | |
return ys | |
else: | |
final_list = bad_prepend(xs[1:], ys) | |
final_list.insert(0, xs[0]) | |
return final_list | |
x = [3,2,1] | |
y = [0,1,2] |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
All programmers are API designers: | |
Good programs are modular, and intermodular boundaries define APIs. Good modules get reused. | |
APIs can be among your greatest assets or liabilities: | |
Good APIs create long-term customers; bad ones create long-term support nightmares. | |
Public APIs, like diamonds, are forever: | |
You have one chance to get it right so give it your best. | |
APIs should be easy to use and hard to misuse: |
gs \ | |
-dCompatibilityLevel=1.4 \ | |
-dCompressFonts=true \ | |
-dSubsetFonts=true \ | |
-dNOPAUSE \ | |
-dBATCH \ | |
-sDEVICE=pdfwrite \ | |
-sOutputFile=$2 \ | |
-c ".setpdfwrite <</NeverEmbed [ ]>> setdistillerparams" \ | |
-f $1 |
# from py2.6 distr | |
# -*- coding: utf-8 -*- | |
""" | |
ast | |
~~~ | |
The `ast` module helps Python applications to process trees of the Python | |
abstract syntax grammar. The abstract syntax itself might change with | |
each Python release; this module helps to find out programmatically what |
#!/bin/bash | |
## This gist contains step by step instructions to install cuda v10.0 and cudnn 7.5 in Ubuntu 18.04 | |
### steps #### | |
# verify the system has a cuda-capable gpu | |
# download and install the nvidia cuda toolkit and cudnn | |
# setup environmental variables | |
# verify the installation | |
### |
#!/bin/bash | |
sudo apt update | |
sudo apt install apt-transport-https ca-certificates curl software-properties-common | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" | |
sudo apt update | |
apt-cache policy docker-ce | |
sudo apt install docker-ce | |
sudo systemctl status docker |
#create key.pem and cert.pem using the following command | |
# >> openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 | |
import BaseHTTPServer, SimpleHTTPServer | |
import ssl | |
httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 443), | |
SimpleHTTPServer.SimpleHTTPRequestHandler) |
import sys | |
def prime_test(n): | |
if n==2: | |
return True | |
if n==1: | |
return False | |
if n%2==0 and n!=2: | |
return False | |
test=True |