Skip to content

Instantly share code, notes, and snippets.

View last-ent's full-sized avatar
😰
It's freezing!

Nikhil last-ent

😰
It's freezing!
View GitHub Profile
@last-ent
last-ent / intro-to-options.scala
Last active June 7, 2020 23:59
Code used in my blog post: Introduction to Option Type - https://last-ent.com/posts/introduction-to-option-type/
/*
BASIC EXAMPLE
*/
val hMap0: Map[Int, Int] = Map(1 -> 102, 2 -> 202, 3 -> 302)
hMap0.get(100)
// What should be the value here?
// `100` does not exist in `hMap`
/*
import cats.effect.IO
class Server(http: Http, database: Database) {
def process(request: Request): IO[Response] = {
val respF =
for {
creds <- request.getCredentials()
authorizedCreds <- authenticateUser(creds)
@last-ent
last-ent / raylib-with-c.md
Last active April 10, 2020 22:54
How to configure RayLib with C for Layman

How to configure RayLib with C for Layman

  1. Clone repository git clone https://github.com/raysan5/raylib.git raylib && cd raylib/src
  2. Compile library to be dynamically linked make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED
  3. Install library sudo make install RAYLIB_LIBTYPE=SHARED # Dynamic shared version.
  4. Set CPATH export CPATH=/usr/local/lib:/usr/local/include (Required by compiler to find the shared library)
  5. Compile Source Code clang -lraylib -o hello hello.c (Using Basic Window example)
  6. Set LD_LIBRARY_PATH LD_LIBRARY_PATH=$CPATH (Required by executable to find the shared library)
  7. Run executable ./hello

Navika Behaviour

Consuming Nakadi Subscription

  • Url: GET /subscriptions/{subscription_id}/events
  • Query Parameters:
    • batch_limit:
      • Maximum number of Events in each chunk (and therefore per partition) of the stream.

      • Default: 1
    • max_uncommitted_events:
@last-ent
last-ent / caq
Last active July 23, 2019 21:38
Creative Achievement Questionnaire
Shelley Carson
Harvard University
A. Visual Arts (painting, sculpture)
__ 0. I have no training or recognized talent in this area.
__1. I have taken lessons in this area.
__2. People have commented on my talent in this area.
__3. I have wona prize orprizes atajuried artshow.
__4. I have had a showing of my work in a gallery.
__5. I have sold a piece of my work.
import os
dirs = ["js", "css", "html"]
for _d in dirs:
try:
os.mkdir("./{}".format(_d))
except:
pass
import sys
import pygame
import pprint
# Create Main Window
window = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Simple Line")
# Start PyGame Instance
# View
class KhinModelView(viewsets.ModelViewSet):
model = KhinModel
queryset = KhinModel.objects.all()
# Endpoint
router = router.Router() # I think
router.register('/path/to/endpoint', KhinModelView)
url = urlpatterns(
rsts_set = [set(i) for i in rsts_slist]
x = rsts_set[0]
for rst in rsts_set:
x = rst.intersection(x)
y = reduce ( set.intersection, rsts_set)
z = rsts_set[0].intersection(*rsts_set[1:])
@last-ent
last-ent / colour_complex.py
Created April 14, 2014 21:20
Plug's colour complex
from itertools import cycle
colours = cycle(['Dark','Light'])
def get_color_complex():
i = 0
dct = {'Light': [], 'Dark': []}
while i<64:
if colours.next() == 'Light':
dct['Light'].append(i)
else: