Skip to content

Instantly share code, notes, and snippets.

View orian's full-sized avatar

Paweł Szczur orian

View GitHub Profile
/**
* 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 20:33
Datastore stats modified to connect to localhost.
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
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)
}
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 July 19, 2014 09:48
Example boost random generating function.
#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);
@orian
orian / quickstart.go
Created August 15, 2014 17:07
Modified version of https://developers.google.com/drive/web/quickstart/quickstart-go app, so it caches access token.
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 August 20, 2014 08:14
sharing bash command history between multiple windows
# 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
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
var w int
for w == 0 {
if a > b {
// Projekt6.1.1
package main
import "fmt"
func NWD(A1, B1 int) int {
var W int
for W == 0 {
// Projekt6.1.1
package main
import "fmt"
func NWD(a, b int) int {
var w int
for w == 0 {
if a > b {