Skip to content

Instantly share code, notes, and snippets.

View eff-kay's full-sized avatar
😀

faizan khan eff-kay

😀
View GitHub Profile
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]
@eff-kay
eff-kay / about.md
Created October 18, 2021 00:18 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@eff-kay
eff-kay / API design
Created June 24, 2021 02:36
Joshua Bloch: Bumper-Sticker API Design
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
@eff-kay
eff-kay / ast.py
Created April 7, 2020 00:42 — forked from buriy/ast.py
# 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
@eff-kay
eff-kay / cuda_10.0_installation_on_Ubuntu_18.04
Created March 9, 2020 03:56 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
CUDA 10.0 installation for Ubuntu 18.04 LTS
#!/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
@eff-kay
eff-kay / HttpsServer.py
Last active September 12, 2019 00:23
Simple ssh server python examples
#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