Skip to content

Instantly share code, notes, and snippets.

View nirodg's full-sized avatar

Dorin Brage nirodg

View GitHub Profile
@nirodg
nirodg / README-Template.md
Created February 19, 2017 09:53 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@nirodg
nirodg / docker_cleanup.sh
Last active June 1, 2017 07:51
Docker CleanUp - Removes containers and volumes
#/bin/bash
# Stopping all containers
docker stop $(docker ps -a -q)
# Removing all containers
docker rm $(docker ps -a -q)
# Removing all volumes
docker volume rm `docker volume ls -q -f dangling=true`
@nirodg
nirodg / sortItem.java
Created March 25, 2018 12:43
Mimic the sortable jquery functionality https://jqueryui.com/sortable/
public static <T> List<T> sortItem(List<T> sortList, int moveFrom, int moveTo) {
if (moveFrom == moveTo) {
// do nothing
return null;
}
boolean isLastPosition = (sortList.size() == moveTo + 1);
T currentElement = sortList.get(moveFrom);
@nirodg
nirodg / ArduinoPotentiometerPosition.ino
Created March 30, 2018 21:56
Potentiometer's degree's position for Arduino
// author: Dorin Brage
// repo: https://github.com/nirodg
long maxRotPtr = 1023; // Max potentiometr value
long totalDegr = 360; // Max degree
long rotationPtr = 0; // Will be fetch from the A0 input
const int sensorInput = 0;
void setup() {
Serial.begin(9600);
}
@nirodg
nirodg / allValuesMatches.java
Created November 28, 2018 13:11
Algorithm for checking if all values of an array are the same.
public static void main(String[] args) {
int[] age = new int[3];
age[0] = 16;
age[1] = 24;
age[2] = 30;
System.out.println(allValuesMatches(age));
}
@nirodg
nirodg / waitingTime.java
Created December 18, 2018 12:15
Wait for X minutes and seconds then it stops.
int minute = 0, seconds = 30, waitingTime = 2;
Calendar currTime = Calendar.getInstance();
Calendar timeSleep = (Calendar) currTime.clone();
timeSleep.add(Calendar.MINUTE, minute);
timeSleep.add(Calendar.SECOND, seconds);
System.out.println(String.format("Now is %s:%s and I will wait until %s:%s", currTime.get(Calendar.MINUTE), currTime.get(Calendar.SECOND),
timeSleep.get(Calendar.MINUTE), timeSleep.get(Calendar.SECOND)));
@nirodg
nirodg / xps_15_9570__dualboot_with_encryption__notes.md
Created January 15, 2020 08:33 — forked from mdziekon/xps_15_9570__dualboot_with_encryption__notes.md
XPS 15 9570 - DualBoot with Encryption (Windows 10 with BitLocker + Ubuntu 18.04 with LVM on LUKS)
  • Based on https://askubuntu.com/a/293029/286776
  • Installation date: 15-09-2018
  • Additional notes based on my own experience
  • The process describes a completely fresh installation with a complete repartitioning, however it should work fine when Windows is already installed (eg. brand new machine with Windows preinstalled).
  • The process was conducted on Dell's XPS 15 9570 (2018) with specs:
    • CPU: i7-8750H
    • Screen: 4K with Touch
    • RAM: 16 GB (original) / 32 GB (manually upgraded)
  • Drive: 512 GB (SK Hynix PC401)
@nirodg
nirodg / Selenide cheat sheet
Created February 28, 2020 20:29 — forked from makolesnik/Selenide cheat sheet
Selenide cheat sheet to create concise UI tests in Java. What is Selenide? Selenide is a wrapper for Selenium WebDriver. http://selenide.org/
=Navigating=
baseUrl = "http://site.com";
open("/login");
open("http://google.com");
switchTo().frame($("#myFrame").toWebElement());
=Alert=
switchTo().alert().accept();
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
37748753 0x2400011 Linux EXT filesystem, rev 1.0, ext4 filesystem data, UUID=28dbe996-15f3-4532-93a3-2b880f220f22
37799955 0x240C813 Linux EXT filesystem, rev 1.0, ext4 filesystem data, UUID=28dbe996-15f3-4532-93a3-2b880f220f22
39191672 0x2560478 Unix path: /opt/usr/media/cred.conf'
39191742 0x25604BE Unix path: /opt/usr/media/cred.conf', error: No such file or directory
39217403 0x25668FB Unix path: /31457280/0/2/14/0/0/0
39230619 0x2569C9B Unix path: /31457280/0/2/14/0/0/0
39243835 0x256D03B Unix path: /31457280/0/2/14/0/0/0