Skip to content

Instantly share code, notes, and snippets.

View lnrsoft's full-sized avatar
🎯
Focusing

lnrsoft lnrsoft

🎯
Focusing
View GitHub Profile
@lnrsoft
lnrsoft / FuncSolution.cpp
Created October 10, 2019 11:04
Factorial digital solution [Written by Roland Ihasz , 10th October 2019]
// Title: Factorial digital solution
// 10th Oct 2019
// Written by Roland Ihasz
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
@lnrsoft
lnrsoft / ip.php
Created May 26, 2019 17:32
Here is a quick solution written in php that you can use to determine the current IP address of a given webhost/domain.
<?php
echo GetClientIP(true);
function GetClientIP($validate = False)
{
$ipkeys = array(
'REMOTE_ADDR',
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
@lnrsoft
lnrsoft / squirrel-sql.sh
Created July 13, 2018 21:44
OSX 10.13 $ ./squirrel-sql.sh Error: Could not find or load main class JavaVersionChecker
#! /bin/sh -x
ABSPATH=$(cd "$(dirname "$0")"; pwd)
# This function sets a global variable named "CP" to a command-path separated list of jars located beneath the
# specified folder. If the specified folder contains a lib directory, then jars beneath the lib folder are
# @ added as well as the squirrel-sql.jar file located in the directory specified as the first argument to
# this function.
buildCPFromDir()
{
@lnrsoft
lnrsoft / roll-a-die.cpp
Created January 23, 2019 20:50
Roll a 6-sided die 5 times using c++
#include <cstdlib>
#include <iostream>
#include <ctime>
int main()
{
std::srand(std::time(nullptr));
int random_variable = std::rand();
std::cout << "Random value on [0 " << RAND_MAX << "]: "
<< random_variable << '\n';
@lnrsoft
lnrsoft / fibonacci.cpp
Last active January 22, 2019 13:10
Here is my C++ program to generate Fibonacci series
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <fstream>
#include <limits.h>
using namespace std;
int main()
@lnrsoft
lnrsoft / box-it.cpp
Last active January 21, 2019 10:10
Box It HRANK problem in c++
// This source code written by Roland Ihasz
#include<bits/stdc++.h>
// #include <iostream>
using namespace std;
class Box {
private:
int l, b, h;
@lnrsoft
lnrsoft / cpp_set_stl.cpp
Last active January 21, 2019 10:08
set STL
// This source code written by Roland Ihasz
#include <set>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
int main()
@lnrsoft
lnrsoft / cpp_variable_sized_arrays.cpp
Last active January 21, 2019 10:08
Multi Level Inheritance
// This source code written by Roland Ihasz
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class Triangle {
@lnrsoft
lnrsoft / cpp_variable_sized_arrays.cpp
Last active January 21, 2019 10:08
Variable Sized Arrays
// This source code written by Roland Ihasz
#include <vector>
#include <iostream>
int main()
{
int n, size, value;
unsigned long q, i, j;
std::cin >> n >> q;
@lnrsoft
lnrsoft / virtual_function.cpp
Last active January 21, 2019 10:08
HackerRank Virtual Function Challenge in C++
// This source code written by Roland Ihasz
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <vector>
class Person {
public: