Skip to content

Instantly share code, notes, and snippets.

Avatar

Paweł Szczur orian

View GitHub Profile
View iterator.h
/**
* Our data structure (e.g., a linked list)
*/
template <class ValueType>;
class MyDataStructure {
/**
* Inner class that describes a const_iterator and 'regular' iterator at the same time, depending
* on the bool template parameter (default: true - a const_iterator)
*/
template<bool is_const_iterator = true>
@orian
orian / datastore_stats.go
Created May 17, 2014
Datastore stats modified to connect to localhost.
View datastore_stats.go
package main
// Simple tool which lists the entity kinds, and a sample for each, for an
// app engine app.
//
// This tool can be invoked using the goapp tool bundled with the SDK.
// $ goapp run demos/remote_api/datastore_info.go \
// -email admin@example.com \
// -host my-app@appspot.com \
// -password_file ~/.my_password
View variables_ready.go
package main
import "fmt"
func main() {
var germany_goals = 7
var brasil_goals = 1
fmt.Printf("Germany:Brasil, wynik: %d:%d\n", germany_goals, brasil_goals)
}
View sum_two_num.go
package main
import "fmt"
func main() {
var pierwsza_liczba int
fmt.Print("Podaj pierwsza liczbe: ")
_, _ = fmt.Scanf("%d", &pierwsza_liczba)
fmt.Println("pierwsza_liczba = ", pierwsza_liczba)
@orian
orian / boost_random.hpp
Created Jul 19, 2014
Example boost random generating function.
View boost_random.hpp
#include <boost/random.hpp>
#include <boost/random/normal_distribution.hpp>
#include <boost/random/random_device.hpp>
#include <boost/random/uniform_real.hpp>
double BoostRandom(double dummy) {
static boost::random_device rd;
static boost::mt19937 rng(rd());
// static boost::normal_distribution<> nd(0.0, 1.0);
// return nd(rng);
View quickstart.go
package main
import (
"fmt"
"log"
"os"
"net/http"
"code.google.com/p/google-api-go-client/drive/v2"
"code.google.com/p/goauth2/oauth"
)
@orian
orian / .bashrc
Created Aug 20, 2014
sharing bash command history between multiple windows
View .bashrc
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=20000
HISTFILESIZE=50000
View projekt_6.go
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
for {
if a > b {
a = a - b
} else if a < b {
View projekt_6.go
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
for a != b {
if a > b {
a = a - b
} else {
View projekt_6.go
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
var w int
for w == 0 {
if a > b {