Skip to content

Instantly share code, notes, and snippets.

@Learath2
Learath2 / 2-7.c
Created August 9, 2014 11:40
K&R2 Exercise 2-7
/*K&R2 Exercise 2-7 "invert"*/
#include <stdio.h>
unsigned invert(unsigned, int, int);
int main()
{
}
@Learath2
Learath2 / 2-9.c
Created August 9, 2014 17:02
K&R2 Exercise 2-9
/*K&R2 Exercise 2-9 "lower"*/
#include <stdio.h>
int lower(int);
int lower(int c)
{
return (c >= 'A' && c <= 'Z') ? c + 'a' - 'A' : c;
}
@Learath2
Learath2 / 3-2.c
Last active August 29, 2015 14:05
K&R2 Exercise 3-2
/*K&R2 Exercise 3-2 "escape"*/
#include <stdio.h>
#define MAX_LINE 1024
int getl(char[], int);
void escape(char[], char[]);
void unescape(char[], char[]);
@Learath2
Learath2 / 4-1.c
Created August 20, 2014 09:16
K&R2 Exercise 4-1
/*K&R2 Exercise 4-1 "strindex"*/
#include <stdio.h>
#define MAX_LINE 1024
int getl(char[], int);
int strindex(char[], char[]);
char pattern[] = "ould";
@Learath2
Learath2 / srvlist.json
Created March 11, 2015 22:59
ServerList
[
{
"version": "Test",
"servername": "Test Server",
"mapname": "map",
"gametype": "Type",
"flags": 0,
"players": 3,
"maxplayers": 16,
"clients": 3,
@Learath2
Learath2 / equ.nim
Created June 28, 2015 17:40
Calculator
from strutils import replace,find,parseInt
echo("Input an operation:")
var line = readLine(stdin)
line = replace(line, " ", "");
let
opindex = find(line, {'+','-','*','/'})
op = line[opindex]
@Learath2
Learath2 / lpf.nim
Created July 2, 2015 17:47
confused
discard """ proc createPrimeList(n: Natural): seq[int] =
result = @[2]
for i in 3..n:
for x in result:
if i mod x == 0:
break
else:
result.add(i)
"""
@Learath2
Learath2 / test.nim
Created July 2, 2015 18:49
nim i64
let
num = 600851475143
res = num / 3
echo($res)
@Learath2
Learath2 / test.nim
Created July 2, 2015 18:50
Nim test
let
num = 600851475143'i64
res = num / 3'i64
echo($res)
@Learath2
Learath2 / text.txt
Created February 3, 2016 10:19
Spook1
Volume in drive D has no label.
Volume Serial Number is DAB7-C31C
Directory of D:\
03.02.2016 12:18 0 kek.log
03.02.2016 12:15 <DIR> program files
1 File(s) 0 bytes
Directory of D:\program files