Skip to content

Instantly share code, notes, and snippets.

Avatar

Paweł Szczur orian

View GitHub Profile
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 {
@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 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 / 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 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)
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)
}
@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 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 / boost_log_test.cc
Created Dec 20, 2013
Boost.Log simplest code + command line to compile it. Boost v1.54 Ubuntu 13.10,
View boost_log_test.cc
#include <boost/log/trivial.hpp>
int main(int, char*[])
{
BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
BOOST_LOG_TRIVIAL(info) << "An informational severity message";
BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
BOOST_LOG_TRIVIAL(error) << "An error severity message";
BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
@orian
orian / gist:7858208
Last active Dec 30, 2015
Adding "swap workspace" to Xmonad
View gist:7858208

1. To imports add: import XMonad.Actions.SwapWorkspaces

2. Somewhere in file, where you have keyboard mapping add:

    -- Swap Workspaces
    , ((modm .|. controlMask,     xK_Right),  swapTo Next)
    , ((modm .|. controlMask,     xK_Left),   swapTo Prev)

3. Reload xmonad, now you can swap workspaces using combination Mod+Ctrl+Left and Mod+Ctrl+Right