Skip to content

Instantly share code, notes, and snippets.

View rksys's full-sized avatar
🎯
Focusing

Pambda rksys

🎯
Focusing
View GitHub Profile
@rksys
rksys / rc.py
Created July 10, 2018 10:15
my percol config file
# Run command file for percol
# X / _ / X
# percol.view.PROMPT = ur"<bold><yellow>X / _ / X</yellow></bold> %q"
# Emacs like
percol.import_keymap({
"C-h" : lambda percol: percol.command.delete_backward_char(),
"C-d" : lambda percol: percol.command.delete_forward_char(),
"C-k" : lambda percol: percol.command.kill_end_of_line(),
@rksys
rksys / mapread.c
Created June 25, 2018 10:43 — forked from marcetcheverry/mapread.c
mmap and read/write string to file
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <unistd.h>
int main(int argc, const char *argv[])
{
              ii.                                         ;9ABH,          
             SA391,                                    .r9GG35&G          
             &#ii13Gh;                               i3X31i;:,rB1         
             iMs,:,i5895,                         .5G91:,:;:s1:8A         
              33::::,,;5G5,                     ,58Si,,:::,sHX;iH1        
               Sr.,:;rs13BBX35hh11511h5Shhh5S3GAXS:.,,::,,1AG3i,GG        
               .G51S511sr;;iiiishS8G89Shsrrsh59S;.,,,,,..5A85Si,h8        
@rksys
rksys / 0_reuse_code.js
Created May 26, 2017 04:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
cc=gcc
cflags=-std=gnu99 -g -Wall
target: libsm.a dsm test_client
libsm.a: libsm.o
ar rvs libsm.a libsm.o
libsm.o:sm.c sm.h message.h message.c mem.h mem.c
$(cc) $(cflags) -c sm.c -o libsm.o
@rksys
rksys / .gitconfig
Created January 14, 2017 13:27 — forked from pksunkara/config
Sample of git config file (Example .gitconfig)
[user]
name = Pavan Kumar Sunkara
email = pavan.sss1991@gmail.com
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@rksys
rksys / mergesort.lhs
Created August 8, 2016 17:14 — forked from callistabee/mergesort.lhs
Haskell Implementation of Mergesort
- Haskell Mergesort
- Copyright (C) 2014 by Kendall Stewart
First we define a couple of helper functions that
will be useful in splitting the list in half:
> fsthalf :: [a] -> [a]
> fsthalf xs = take (length xs `div` 2) xs
def __truedive__(self,fraction):
if fraction.numerator == 0:
print('Cannot divide by 0')
exit()
else:
return(Fraction(self.numerator*fraction.denominator,self.denominator*fraction.numerator))
struct retval myread(int fd_id, void *buf, size_t nbytes) {
struct retval retval;
retval.errno = NO_ERROR;
retval.val_h = (int*) FAILED;
retval.val_l = (int*) FAILED;
if (fd_id <= FREE_FD || fd_id >= OPEN_MAX) {
retval.errno = EBADF;
return retval;
}
@rksys
rksys / Perceptron.py
Created February 27, 2016 04:05
a sample of Perceptron Learning Algorithm
import numpy as np
import random
import os, subprocess
class Perceptron:
def __init__(self, N):
# Random linearly separated data
xA,yA,xB,yB = [random.uniform(-1, 1) for i in range(4)]
self.V = np.array([xB*yA-xA*yB, yB-yA, xA-xB])
self.X = self.generate_points(N)