Skip to content

Instantly share code, notes, and snippets.

View RoyBellingan's full-sized avatar

Roy Bellingan RoyBellingan

View GitHub Profile
@RoyBellingan
RoyBellingan / server.cpp
Created November 18, 2016 12:14
Dumb Server
/* A simple server in the internet domain using TCP
The port number is passed as an argument */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <QList>
@RoyBellingan
RoyBellingan / client.cpp
Created November 18, 2016 12:17
MT Client
//Link with LIBS += -lpthread
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
@RoyBellingan
RoyBellingan / StrCleaner1.cpp
Created November 27, 2016 16:17
StrCleaner1
void STRCleaner1(QChar* a, quint32 siz){
__m64* base;
__m64* mask1;
__m64* mask2;
__m64* mask3;
__m64* res = new __m64();
quint64* opt;
//quint64* mask1_safe;
//quint64* mask2_safe;
@RoyBellingan
RoyBellingan / escape.cpp
Created November 27, 2016 16:36
Escape
QString escapeCharacters(QString input) {
const static quint32 slash = 0x005C005C;
const static quint32 f_slash = 0x002F005C;
const static quint32 quote = 0x0022005C;
const static quint32 newline = 0x006E005C;
quint16* data = (quint16*) malloc(16384 * 2);
quint32 offset = 0;
quint32 treshold = 16000; //reserve 8 byte at least...
Xoroshiro128 with seed uint64_t s[2]{762,558121992};
Cicle 1 elapsedTotal : 0 . 5.54e+08, this run 0 . 5.54e+08 Nuclide status: 368997385 vs 88 decayedRadon: 0
Cicle 2 elapsedTotal : 1 . 1.02e+08, this run 0 . 5.47e+08 Nuclide status: 368997361 vs 112 decayedRadon: 0
Cicle 3 elapsedTotal : 1 . 6.03e+08, this run 0 . 5.01e+08 Nuclide status: 368997297 vs 176 decayedRadon: 0
Cicle 4 elapsedTotal : 2 . 1.00e+08, this run 0 . 4.97e+08 Nuclide status: 368997257 vs 216 decayedRadon: 0
Cicle 5 elapsedTotal : 2 . 6.45e+08, this run 0 . 5.45e+08 Nuclide status: 368997225 vs 248 decayedRadon: 0
Cicle 6 elapsedTotal : 3 . 1.47e+08, this run 0 . 5.02e+08 Nuclide status: 368997145 vs 328 decayedRadon: 0
Cicle 7 elapsedTotal : 3 . 6.43e+08, this run 0 . 4.96e+08 Nuclide status: 368997129 vs 336 decayedRadon: 8
Cicle 8 elapsedTotal : 4 . 1.42e+08, this run 0 . 4.99e+08 Nuc
//compile with
//g++ -O2 -march=native -ftls-model=initial-exec -g -o nancy nancy.cpp -lpthread
#include <thread>
#include <atomic>
#include <pthread.h>
#include <unistd.h>
-- Adminer 4.3.1 MySQL dump
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS `item`;
CREATE TABLE `item` (
`id` int(11) NOT NULL AUTO_INCREMENT,
Porting of code from matlab to C++ multithread about 6hour (lot of boiler plate code to write)
Porting of C++ code in OpenCL 4 hour
If the simulation is one shot, there is no need to optimization, but if has to run 24/7 ...
Result for https://github.com/RoyBellingan/decay1
----------
global_size = (128 * 7) * 8;
#!/bin/bash
#very slow /./
for db in DSPRemote ExternalPlatforms chameleon cookie inventorydb powerdns
do
tables=`mysql -u root -padmin --batch -N -e "select table_name from information_schema.tables where table_type='BASE TABLE' and table_schema='$db';"`
views=`mysql -u root -padmin --batch -N -e "select table_name from information_schema.tables where table_type='VIEW' and table_schema='$db';"`
dat=`date +%s`;
class maxPos{
public:
double a;
operator double() {
return a;
}
bool operator>(double b) = delete;
};
int main() {