This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
system ? builtins.currentSystem, | |
sources ? import ./npins, | |
}: | |
let | |
pkgs = import sources.nixpkgs { inherit system; }; | |
lib = pkgs.lib; | |
in | |
pkgs.mkShell { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# Script to install NixOS from the Hetzner Cloud NixOS bootable ISO image. | |
# (tested with Hetzner's `NixOS 20.03 (amd64/minimal)` ISO image). | |
# | |
# This script wipes the disk of the server! | |
# | |
# Instructions: | |
# | |
# 1. Mount the above mentioned ISO image from the Hetzner Cloud GUI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assumes, there is a channel called 'nixpkgs', see https://nixos.wiki/wiki/Nix_channels | |
{ pkgs ? import <nixpkgs> {} }: | |
pkgs.mkShell { | |
buildInputs = with pkgs; [ | |
# Package goes there | |
# You can search packages via `nix search $term` or from https://search.nixos.org/packages | |
]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Node { | |
Node() : next{0}, value{0}, head{true} | |
{ } | |
Node(int val, Node* next = 0) : next{next}, value{val}, head{false} | |
{ } | |
~Node() { | |
if (next) | |
delete next; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "PhoneBook.h" | |
#include <cassert> | |
int main(int argc, char const *argv[]) | |
{ | |
PhoneBook pb; | |
assert(pb.addPerson("onur")); | |
assert(pb.addPerson("can")); | |
assert(pb.addPerson("betul")); | |
assert(!pb.addPerson("onur")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
std::chrono::time_point< std::chrono::system_clock > startTime; | |
std::chrono::duration< double, std::milli > elapsedTime; | |
for (int i = 0; i < MAX_VALUE; i += 10000000) { | |
startTime = std::chrono::system_clock::now(); | |
for (int j = 0; j < REPEAT; ++j) { | |
//call the function | |
int result = fib(i); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MAC.h" | |
#include <iostream> | |
MAC::MAC() : musicAlbums{nullptr}, | |
noOfMusicAlbums{0}, | |
_cap{0} | |
{ | |
} | |
MAC::~MAC() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct test_vector_insert | |
{ | |
kstd::vector<int> test_vector; | |
test_vector_insert() : test_vector() | |
{ | |
for (int i = 1; i <= 10; ++i) | |
{ | |
test_vector.push_back(i); | |
} | |
require_begin_insert(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void print_pairs(const char *nucleotides, int len) | |
{ | |
int count = 0; | |
for (int i = 0; i < len; ++i) { | |
if (nucleotides[i] == nucleotides[i + 1]) { | |
count += 1; | |
printf("%c%c\n", nucleotides[i], nucleotides[i]); | |
} |