Skip to content

Instantly share code, notes, and snippets.

View gorakhargosh's full-sized avatar

Yesudeep Mangalapilly gorakhargosh

View GitHub Profile
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 17:47
digital root god names
#!/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 February 23, 2018 05:43
Yukti & Yesudeep Wedding Invitation
We couldn’t find that file to show.
// A static file server written in Go.
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
@gorakhargosh
gorakhargosh / mutual-recursion.js
Last active October 8, 2015 21:30
How to interleave 10 and 9 (while also causing a stack overflow). Code only works in language that has function hoisting.
a(10, 1);
function a(n, steps) {
console.log(n, steps);
if (n == 1) {
return 0;
}
return b(n - 1, steps+1);
}
; 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
;printing a string
prints macro str
push ax
push bx
push cx
push dx
push si
mov ah,09h
lea dx,str
int 21h
;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 October 8, 2015 13:06
November 30, 2005 - Program for Divya Nayudu when she was doing her MCA.
;program to check whether no is prime or not
.model small
.386
.stack 100h
include newmac.inc
.data
Sign DB 0
M32768 DB "-32768$"
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#define DEBUG 0