Skip to content

Instantly share code, notes, and snippets.

View PanagiotisPtr's full-sized avatar
:shipit:
I use vim btw

Panagiotis Petridis PanagiotisPtr

:shipit:
I use vim btw
View GitHub Profile
@PanagiotisPtr
PanagiotisPtr / add_key.md
Created July 4, 2018 18:11
Add ssh key on Github

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

You will be aksed where you want to save the file. Choose something reasonable

ssh-add [file_location_from_before.pub]

Add your key on github ( User -> settings -> ssh keys ) Check that the key has been added

ssh-add -l

@PanagiotisPtr
PanagiotisPtr / capture.py
Created December 15, 2018 00:29
Screencapture scrollable page
# This script does use selenium and the firefox webdriver to run
# make sure you setup those first.
from selenium import webdriver
import time
options = webdriver.FirefoxOptions()
options.add_argument("--headless")
driver = webdriver.Firefox(firefox_options=options)
@PanagiotisPtr
PanagiotisPtr / Tensor.h
Created December 31, 2018 17:30
Simple n-dimensional array class ( Tensor ) in C++
#ifndef TENSOR_H
#define TENSOR_H
#include <vector>
#include <ostream>
static bool math_indexing = true;
template<typename T, size_t size>
class Tensor {
@PanagiotisPtr
PanagiotisPtr / Sort.h
Last active December 31, 2018 19:31
parallel and serialized versions of mergesort in C++
#ifndef SORT_H
#define SORT_H
#include <algorithm>
#include <list>
#include <iterator>
#include <future>
#include <iostream>
@PanagiotisPtr
PanagiotisPtr / Trie.h
Created January 10, 2019 15:27
Simple Trie implementation in C++
#ifndef TRIE_H
#define TRIE_H
#include <unordered_map>
#include <exception>
#include <memory>
#include <string>
#include <list>
#include <stack>
@PanagiotisPtr
PanagiotisPtr / main.c
Last active January 10, 2019 15:29
Simple sockets server wrapper in C
#include <stdio.h>
#define DEBUG
#include "server.h"
int main(int argc, char **argv) {
server s;
server_init(&s, AF_INET, SOCK_STREAM,\
IPPROTO_TCP, 1313, INADDR_ANY);
server_listen(&s, 15);
@PanagiotisPtr
PanagiotisPtr / ppa.h
Last active January 25, 2019 00:34
Simple examples of parallel and serialized algorithms in C++
#ifndef PPA_H
#define PPA_H
#include "ppa_impl.h"
namespace ppa {
template<
typename RandomIt,
typename value_type = typename std::iterator_traits<RandomIt>::value_type
@PanagiotisPtr
PanagiotisPtr / encoding.cpp
Created April 19, 2019 21:27
Tic Tac Toe Board Encoding and Comparing (TTTBEC for short)
#include <iostream>
#include <vector>
#include <array>
using namespace std;
template<typename T>
using board = vector<vector<T> >;
typedef array<char, 3> encoding;
@PanagiotisPtr
PanagiotisPtr / card.html
Created May 2, 2019 12:23
Simple Material Design card
<!DOCTYPE html>
<!-- Similar to: https://storage.googleapis.com/spec-host-backup/mio-design%2Fassets%2F1eZNTdj8h1J0BFkbl23LyzEwjjvMzY_uV%2Fcards-elements-2b.png -->
<html>
<style>
body {
font-family: 'Roboto', sans-serif;
}
.row-container {
display: flex;
flex-direction: row;
@PanagiotisPtr
PanagiotisPtr / parse_competition.py
Created July 3, 2019 20:50
codeforces parsers and C++ solution tester
import requests
from bs4 import BeautifulSoup
import sys
import os
template = """#include <bits/stdc++.h>
using namespace std;
class Solution {