Skip to content

Instantly share code, notes, and snippets.

Avatar

Yesudeep Mangalapilly gorakhargosh

View GitHub Profile
View direct_deposit_problem.py
def beta_direct_deposit(pay, percent_split=[1]):
"""What you guys are doing."""
s = 0
results = [0]
for i, v in enumerate(percent_split):
s += results[i]
results.append((pay - s) * v)
residual = pay - sum(results)
results.append(residual)
return results[1:]
@gorakhargosh
gorakhargosh / digital_root.py
Created May 13, 2016
digital root god names
View digital_root.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections
letter_map = {
"a": 1,
"b": 2,
"c": 3,
"d": 4,
@gorakhargosh
gorakhargosh / wedding-invitation.py
Last active Feb 23, 2018
Yukti & Yesudeep Wedding Invitation
We couldn’t find that file to show.
View serve.go
// A static file server written in Go.
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
@gorakhargosh
gorakhargosh / mutual-recursion.js
Last active Oct 8, 2015
How to interleave 10 and 9 (while also causing a stack overflow). Code only works in language that has function hoisting.
View mutual-recursion.js
a(10, 1);
function a(n, steps) {
console.log(n, steps);
if (n == 1) {
return 0;
}
return b(n - 1, steps+1);
}
View primes.asm
; PROGRAM TO GET FIRST N NO OF PRIMES
;including the macro file
include macros.inc
data segment
cr equ 0dh ;ASCII code for carriage return
lf equ 0ah ;ASCII code for line feed
View macros.inc
;printing a string
prints macro str
push ax
push bx
push cx
push dx
push si
mov ah,09h
lea dx,str
int 21h
View macros1.inc
;start the program
start macro
mov ax,@data
mov ds,ax
endm start
;clearing the screen
clrscr macro
push ax
push bx
@gorakhargosh
gorakhargosh / newprime.asm
Last active Oct 8, 2015
November 30, 2005 - Program for Divya Nayudu when she was doing her MCA.
View newprime.asm
;program to check whether no is prime or not
.model small
.386
.stack 100h
include newmac.inc
.data
Sign DB 0
M32768 DB "-32768$"
View components_in_graph.c
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define DEBUG 0