Skip to content

Instantly share code, notes, and snippets.

View hmenn's full-sized avatar
🎧
Focusing

Hasan MEN hmenn

🎧
Focusing
View GitHub Profile
@hmenn
hmenn / gitlab-docker-compose-1.yml
Created August 19, 2019 06:23
Basic Gitlab Docker Compose Configurations
gitlab:
container_name: gitlab
image: 'gitlab/gitlab-ee:latest'
restart: always
# Add your dns name here
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
# Add your dns name here
external_url 'http://gitlab.example.com'
@hmenn
hmenn / mangle_demangle.cpp
Created July 28, 2019 18:51
c++ mangling demangling example
#include <typeinfo>
#include <iostream>
#include <string>
#include <vector>
#include <cxxabi.h>
struct A{
std::vector<int> a;
};
@hmenn
hmenn / default.xml
Created June 25, 2019 12:24
Base RepoTool XML config file
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="origin"
fetch="ssh://addr1" />
<remote name="other-origin"
fetch="ssh://addr2" />
<project path="download_path1" name="project_under_remote" remote="other-origin" revision="develop" />
@hmenn
hmenn / minBribes.cpp
Created March 2, 2019 22:24
hackerrank - interview kit - arrays
void minimumBribes(vector<int> q) {
const int maxbribe=2;
int step=0;
bool invalid=false;
int personsize = q.size() - 1;
while(true){
bool bribed = false;
int bribeCount = 0;
@hmenn
hmenn / rotLeft.cpp
Created March 2, 2019 19:52
hackerrank - intertiew kit - arrays
// Complete the rotLeft function below.
vector<int> rotLeft(vector<int> a, int d) {
std::vector<int> v;
for(int i=0; i<a.size();++i){
v.push_back(a[(i+d)%a.size()]);
}
return v;
}
@hmenn
hmenn / hourglassSum.cpp
Created March 2, 2019 19:40
hackerrank - interview kit - 2d arrays
/*
Given a 2D Array, :
1 1 1 0 0 0
0 1 0 0 0 0
1 1 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
We define an hourglass in to be a subset of values with indices falling in this pattern in 's graphical representation:
@hmenn
hmenn / paranthesis_matching.hpp
Created February 26, 2019 14:18
Interview Cake Weekly Problem #232: Parenthesis Matching
/*
I like parentheticals (a lot).
"Sometimes (when I nest them (my parentheticals) too much (like this (and this))) they get confusing."
Write a function that, given a sentence like the one above, along with the position of an opening parenthesis, finds the corresponding closing parenthesis.
Example: if the example string above is input with the number 10 (position of the first parenthesis), the output should be 79 (position of the last parenthesis).
*/
@hmenn
hmenn / cxx11-example-accumulate.hpp
Created February 26, 2019 09:47
CXX11 Accumulate function examples
#include <iostream>
#include <string>
#include <numeric>
#include <vector>
int main() {
std::vector<int> v{1,2,3,4,5,6,7,8,9,10};
auto dash_fold = [](std::string a, int b){
return a+ "-"+ std::to_string(b);
@hmenn
hmenn / s1e13-exercise.hpp
Created February 26, 2019 07:11
basic thread example from modern cpp concurrency in depth
#include <iostream>
#include <queue>
#include <thread>
#include <atomic>
#include <string>
#include <chrono>
int main() {
std::queue<int> qth1, qth2;
std::thread th1, th2;
@hmenn
hmenn / s1e8-exercise.hpp
Created February 25, 2019 13:51
basic thread example from modern cpp concurrency in depth
#include <iostream>
#include <thread>
enum COMMAND{CLEAN, FULL_SPEED_AHEAD, EXIT};
int main() {
int cmd;
bool done=false;