Skip to content

Instantly share code, notes, and snippets.

#define EPS 1e-6
lat_h = floor(lat);
lat_m = floor(60.0 * (lat - lat_h));
lat_s = 3600.0 * ((lat - lat_h) - (lat_m / 60.0));
if (fabs(lat_s - 60) < EPS) {
lat_s = 0;
lat_m++;
}
Cílem práce je naprogramovat ftp server. Server bude konfigurovatelný pomocí souboru. Konfigurovat půjde rozhraní, kde server naslouchá, kořeny FTP serveru, generovaný log přenosů a databáze uživatelů a jejich hesel. Server bude umožňovat vytvoření virtuálního filesystému. Virtuálním filesystémem se rozumí souborový systém, na který bude přistupovat ftp client a který se bude mapovat na nějaké adresáře/soubory na disku. Tzn. clientův adresářový strom bude vypadat následovně: /home/user1 mapuje na /mnt/x/home/user1 /www mapuje na /var/cache/www /home/user_list.txt mapuje na /var/ftpclient/user_list.txt Přihlášený uživatel tedy uvidí adresáře /home/user1 a /www a soubory /home/user_list.txt
@PMitura
PMitura / 0_reuse_code.js
Created February 5, 2016 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@PMitura
PMitura / gist:6a55b11b876e505d5eaa2709e40b67ea
Created August 5, 2016 11:32
Sigmoid activation crash @ GPU powered training of keras RNN
Traceback (most recent call last):
File "./run.py", line 38, in <module>
main(sys.argv[1:])
File "./run.py", line 33, in main
rnn.rnn.run()
File "/home/samurai/Smiles/smiles-neural-network/rnn/rnn.py", line 569, in run
epochsDone = train(model, trainIn, trainLabel, (testIn, testLabel))
File "/home/samurai/Smiles/smiles-neural-network/rnn/rnn.py", line 108, in train
validation_data = (validation[0], formattedValid))
File "/home/samurai/.local/lib/python2.7/site-packages/keras/models.py", line 413, in fit
#include <bits/stdc++.h>
#include <omp.h>
using namespace std;
int SIZE = 1e8;
int main() {
srand(time(NULL));
int * aligned = new int[SIZE],
8.000, 0.002, 0.000, 0.000, 0.001, 0.001, 0.000, 0.000, 0.000, 0.402, 0.000,
7.000, 0.002, 0.007, 0.000, 0.001, 0.001, 0.001, 0.000, 0.700, 0.000, 0.003,
5.000, 0.000, 0.001, 0.000, 0.001, 0.004, 0.441, 0.001, 0.000, 0.001, 0.001,
0.000, 0.755, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.001, 0.003, 0.000,
0.000, 0.698, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.001, 0.006, 0.000,
5.000, 0.000, 0.002, 0.000, 0.001, 0.004, 0.604, 0.001, 0.001, 0.001, 0.001,
0.000, 0.703, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.005, 0.000,
5.000, 0.000, 0.001, 0.000, 0.001, 0.003, 0.334, 0.002, 0.000, 0.004, 0.000,
0.000, 0.732, 0.001, 0.000, 0.000, 0.000, 0.000, 0.000, 0.001, 0.003, 0.000,
8.000, 0.001, 0.000, 0.000, 0.001, 0.001, 0.001, 0.000, 0.000, 0.520, 0.000,
int N;
struct Edge { int from, to, residue; };
vector<Edge> edges;
vector<int> graph[N]; // graph[node] = indexes of outgoing edges
void add_edge(int from, int to, int capacity) {
graph[from].push_back(edges.size());
edges.push_back(Edge{from, to, capacity});
graph[to].push_back(edges.size());
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long u64;
vector<u64> gen(u64 x, u64 k) {
u64 bound = 1ULL << x;
vector<u64> result;
for (u64 i = 0; i < bound; i++) {
if (__builtin_popcountll(i) == k) {
result.push_back(i);
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long u64;
vector<u64> gen(u64 x, u64 k) {
u64 bound = 1ULL << x, p = 0;
for (u64 i = 0; i < k; i++)
p |= 1ULL << i;
vector<u64> result;
// courtesy of http://graphics.stanford.edu/~seander/bithacks.html#NextBitPermutation
[1] EREW / CREW / CRCW (priority, arbitrary, common) [4b]
[2] typy schedulingu [4b]
[3] definujte hranovy rez a bisekcnu sirku [4b]
[4] preco je tento kod mergesortu pomaly? [8b]
[5] synchronizacia pristupu [8b]
[6] paralelna binarna scitacka / PPS [10b]
[7] Cannon [12b]