Skip to content

Instantly share code, notes, and snippets.

View montreal91's full-sized avatar
💭
Set your status

Alexander Nefedov montreal91

💭
Set your status
  • Belgrade, Serbia
View GitHub Profile
@montreal91
montreal91 / point-and-click.cc
Created April 23, 2016 05:12
SFML point-and-click
#include <cmath>
#include <SFML/Graphics.hpp>
void CenterOrigin(sf::Sprite* sprite) {
sf::FloatRect bounds = sprite->getLocalBounds();
sprite->setOrigin(
std::floor( bounds.left + bounds.width / 2.0f ),
std::floor( bounds.top + bounds.height / 2.0f )
@montreal91
montreal91 / main.cc
Created March 5, 2016 20:03
Evil inheritance
#include <iostream>
template<typename T>
class EvilClass {
public:
virtual void DoSomething( T param ) {
std::cout << "I've done something\n";
}
};
@montreal91
montreal91 / foo.sh
Last active February 16, 2016 18:24
thetravellingfox crashreport
:AppRunner: Total Panda3D disk space used: 0 MB
:util: Reading /home/montreal/Grimfang Studios/The Traveling Fox/The Traveling Fox.prc
:02-16-2016 22:47:31 ShowBase: Default graphics pipe is glxGraphicsPipe (OpenGL).
:02-16-2016 22:47:31 ShowBase: Successfully opened window of type glxGraphicsWindow (OpenGL)
:02-16-2016 22:47:31 ShowBase: __dev__ == False
ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:942:(snd_pcm_route_determine_ttable) Invalid slave channel: FL
@montreal91
montreal91 / rpn.cc
Created February 15, 2016 10:23
Right Poland Notation -> Infix Notation
#include <iostream>
#include <fstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
enum operation_type
@montreal91
montreal91 / console_input.txt
Last active February 14, 2016 14:35
Multiple Blender crashes
>>> v = []
>>> v.append(Vector((3,0,0)))
>>> v.append(Vector((0,3,0)))
>>> v.append(Vector((0,0,3)))
>>>
>>> f = [[0,1,2]]
>>> m = D.meshes.new("mm")
>>> m.from_pydata(v, [], f)
>>> o = D.objects.new("mm", m)
>>> C.scene.objects.link(o)
@montreal91
montreal91 / mul.cc
Created December 30, 2015 00:58
mul
#include <algorithm>
#include <ctime>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include "fft.h"
@montreal91
montreal91 / out.txt
Created December 28, 2015 19:41
multiplication
---------------------------
Schonhage Stassen Algorithm
Testing on trivial cases
---------------------------
1. 100
Time elapsed: 0.074 ms
2. 123
Time elapsed: 0.071 ms
@montreal91
montreal91 / out
Created December 28, 2015 19:26
matrix
4 8 6 1 88
4 64 8 42 1
5 0 -5 8 4
8 5 55 45 88
algebraic complement of the element0 0
error, there is no such element
4 8 6 1 88
4 64 8 42 1
5 0 -5 8 4
8 5 55 45 88
@montreal91
montreal91 / point.cc
Created December 22, 2015 14:08
point
struct Point {
Point() {
x = 0;
y = 0;
}
Point(double new_x, double new_y) {
x = new_x;
y = new_y;
}
double x, y;
@montreal91
montreal91 / some.sql
Created December 18, 2015 20:03
insert
INSERT INTO nay_computatuon(n_computation, d_computation, n_tariff, n_info_hot, n_info_cold, n_pay, n_sum_hot, n_sum_cold, n_client, n_total, n_debt, n_difference_hot, n_difference_cold)
VALUES (
SELECT DISTINCT nay_computation.d_computation, 21 AS n_tariff, (
SELECT round(avg(n_info_hot), 0)
FROM nay_computation
) AS info_hot,(
SELECT round(avg(n_info_cold), 0)
FROM nay_computation
) AS info_cold, (
SELECT round(avg(n_pay),0)