Skip to content

Instantly share code, notes, and snippets.

View pyk's full-sized avatar
🐈‍⬛
I may be slow to respond.

pyk pyk

🐈‍⬛
I may be slow to respond.
View GitHub Profile
@pyk
pyk / input.txt
Created March 12, 2015 15:49
Read data from a file using go language. Read more here https://golang.kertaskampus.com/How-To-Read-Data-From-A-File/
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
@pyk
pyk / output.go
Created March 14, 2015 07:13
An example program that write data to a file in Go programming language. Learn more https://golang.kertaskampus.com/write-data-to-a-file/
package main
import (
"fmt"
"log"
"os"
)
func main() {
file, err := os.OpenFile("output.txt", os.O_RDWR, os.ModePerm)
john 16 male
alice 17 female
brian 17 male
ammy 15 female
@pyk
pyk / markdown.css
Last active August 29, 2015 14:19 — forked from imjasonh/markdown.css
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
  1. General Background and Overview
@pyk
pyk / string.c
Created July 5, 2015 00:59
string & list of string in C
#include <stdio.h>
int
main()
{
/* character */
char a;
a = 's';
printf("char a\t= %c\n", a);
@pyk
pyk / vim-for-ide.md
Created July 18, 2015 00:12
Use vim for IDE

This is bunch of vim tips that I gather from the internet.

Project-specific configuration

" forces vim to source .vimrc file if it present in working directory
set exrc
" restrict usage of some commands in non-default .vimrc files
set secure

Navigate source code

@pyk
pyk / fib-dp.c
Last active August 29, 2015 14:25
the comparison of naive recursion and dynamic programming to compute n-th fibonacci number
#include <stdio.h>
long long fib(long long n);
long long fibs[100];
long long
main()
{
long long i;
@pyk
pyk / n.c
Created July 22, 2015 23:56
Exercise 1.2-2 & 1.2-3 on Introduction to Algorithm book by Cormen et al.
#include <stdio.h>
#include <math.h>
int
main()
{
int n;
for(n = 1; n < 10000; n++) {
if((8*pow(n,2)) < (64*n*log(n))) {
@pyk
pyk / insertion-sort.c
Last active August 29, 2015 14:25
Implementation of Sorting algotithm in C language
/* compile: gcc -o insertion-sort insertion-sort.c */
#include <stdio.h>
int
main()
{
int i;
int A[6] = {5, 2, 4, 6, 1, 3};
for(i = 1; i < 6; i++) {