Skip to content

Instantly share code, notes, and snippets.

View lnrsoft's full-sized avatar
🎯
Focusing

lnrsoft lnrsoft

🎯
Focusing
View GitHub Profile
@lnrsoft
lnrsoft / resizer.py
Created January 17, 2015 19:20
Resize jpeg files by size in a given folder in Python
from PIL import Image
import datetime
import os.path
import glob
import time
import PIL
import os
def modification_date(filename):
@lnrsoft
lnrsoft / single_vector.cpp
Last active January 21, 2017 21:38
[C++] Store different types in one single vector
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <string>
class User_data
{
public:
User_data(int i, std::string fn, std::string sn, std::string d, double w)
: id(i), fname(fn), sname(sn), dob(d), weight(w) { }
@lnrsoft
lnrsoft / factorials.cpp
Created November 19, 2015 20:40
You are given an integer n. Determine the factorial of this number.
#include <vector>
#include <iostream>
int main()
{
std::vector<int> factorials;
factorials.push_back(1);
int n;
std::cin >> n;
for (auto i = 1; i <= n; i++)
@lnrsoft
lnrsoft / astylerc
Last active November 22, 2015 16:14
My astyle configuration
--style=stroustrup -A4
--indent=spaces
--add-brackets -j
--max-code-length=80
--mode=c
--close-templates -xy
--align-pointer=name -k3
--align-reference=name -W3
--delete-empty-lines -xe
--unpad-paren -U
@lnrsoft
lnrsoft / Alternating_Characters.cpp
Last active September 6, 2016 23:29
HackerRank Challenges & Solutions
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <sstream>
int alter(std::string Nline)
{
std::vector<int> NBuffer;
std::vector<int> lister;
std::vector<char> AnswerBuffer(Nline.begin(), Nline.end());
@lnrsoft
lnrsoft / Angry_Professor.cpp
Last active September 6, 2016 23:28
HackerRank Challenges & Solutions
// This source code written by Roland Ihasz
#include <iostream>
#include <vector>
#include <sstream>
int main()
{
std::vector<int> NBuffer;
std::vector<std::string> AnswerBuffer;
std::string Nline;
@lnrsoft
lnrsoft / library_fine.cpp
Created September 9, 2016 18:54
Library Fine
// This source code written by Roland Ihasz
#include <vector>
#include <iostream>
int rdn(int y, int m, int d)
{
if (m < 3)
{
y--, m += 12;
}
@lnrsoft
lnrsoft / chocolate_feast.cpp
Created September 9, 2016 19:32
Chocolate Feast HackerRank Solution in C++
// This source code written by Roland Ihasz
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
std::vector<int> vec;
void chockFunc(int nu, int co, int mn)
@lnrsoft
lnrsoft / gcpp_uncrustify.cfg
Last active June 20, 2022 13:06
Google C++ Style Uncrustify configuration
indent_align_string=true
indent_braces=false
indent_braces_no_func=false
indent_brace_parent=false
indent_namespace=false
indent_extern=false
indent_class=true
indent_class_colon=true
indent_else_if=false
indent_func_call_param=false
@lnrsoft
lnrsoft / mysql-reset-root-pw.sh
Last active October 25, 2016 01:24 — forked from sorohan/mysql-reset-root-pw.sh
Reset mysql root password on unix without needing old password.
#!/bin/bash
MYSQL_ROOT_PASSWORD=$1
if [ -z "$MYSQL_ROOT_PASSWORD" ]; then
echo 'Missing required $1 (password).'
exit 1
fi
# check if mysql is running now.