View set-repo mint2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first we have to edit sources.list file using gedit | |
remember this method is using terminal! | |
To open up terminal hit "ctrl+alt+T" | |
then type "gedit /etc/apt/sources.list" | |
delete all text inside, then replace with the new one, | |
#repo ITB : | |
deb ftp://ftp.itb.ac.id/pub/ubuntu oneiric main restricted universe multiverse |
View Automate Daily with Shell script - Series
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This gonna be usefull when U have some pattern actvities to done continously wo/ doing it manually | |
1. Problem: need to execute `arp -d` continously, the command to delete host on arp table to reset it to first time connect to wifi or other connection gateway. This could even be prevent the user in same connection's gateway which use `internet cut` software (might be myth). Every time the command execute, your computer delete the inet_addr that already chaced to your computer then re-request to gateway point to give you new chace. This usually used when your computer have problem to connect to internet, so your computer need to refresh the chace inet_addr. (I might be wrong sorry, I'm not expert) | |
#!/bin/bash | |
echo 'Running command' | |
set -x #echo on everything the command executed | |
while true; |
View pick random element list java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static <E> List<E> pickNRandomElements(List<E> list, int n, Random r) { | |
int length = list.size(); | |
if (length < n) return null; | |
//don't need to shuffle the whole list | |
for (int i = length - 1; i >= length - n; --i) { | |
Collections.swap(list, i, r.nextInt(i + 1)); | |
} | |
return list.subList(length - n, length); |
View status_service_mongoDB-win10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mongo --eval "db.stats()" # do a simple harmless command of some sort | |
RESULT=$? # returns 0 if mongo eval succeeds | |
if [ $RESULT -ne 0 ]; then | |
echo "MongoDB service is not running, try to run with admin" | |
sleep 3 #3 secs | |
exit 1 | |
else |
View stop_service_mongoDB-win10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo 'Trying to STOP service MongoDB' | |
set -x #for echo on | |
net stop MongoDB | |
echo 'Done STOP service MongoDB' | |
sleep 3 #3 secs |
View KoinJavaUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.common.utils | |
import org.koin.KoinContext | |
import org.koin.standalone.StandAloneContext | |
import kotlin.jvm.internal.Reflection | |
/** | |
* @author @fredy_mederos | |
*/ |
View upload whole file project into github via CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
based on tutorial in http://stackoverflow.com/a/12800042 | |
and this tutorial to upload existing project into github. | |
so, you need to create new repository first | |
Steps: | |
- make sure you have installed git in your computer | |
- open the directory project then open CMD in it | |
- type 'git init'. This will say "Initialized empty git repository in ....git" (... is the path). | |
- type 'git add .' Dont forget 'pull stop' mark in the end of add after 'space'. I assume you wanna upload a whole file inside the directory. | |
- type 'git commit -m "massage here for commit" |
View nvm setup with windows 10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- take a look git repo [over here](https://github.com/coreybutler/nvm-windows/releases) | |
- or you can see mine I've downloaded [here](https://bit.ly/nvmSetup) version 1.1.17 | |
- finished downloaded, execute & follow installation as regular | |
- finished installation, check with command `nvm --version` if doesn't show anything try to restart windows | |
- check again till version `nvm --version` shown | |
- install node version you wanna use with command `nvm install node_version` it will download required files node js along with NPM | |
- finished installed node_version, then type `nvm use node_version` you just installed | |
- type `nvm list` to see node version installed you able to use directly | |
- or `nvm list available` to see all list you ready to install with version LTS and latest version | |
- DONE |
View Android parameterize test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
as regular test using unit test we can use jUnit roboelectric Mockito etc. There are some condition which class with parameter more than 1 | |
ex. inteface class | |
`double getPriceAfterSurcharge(double baseCost, double surchargeFixedPrice, double surchargePercentage, Integer quantity);` | |
implementation class: | |
@Override | |
public double getPriceAfterSurcharge(double baseCost, double surchargeFixedPrice, | |
double surchargePercentage, Integer quantity) { | |
double productPrice; |
View Jacoco Setup Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
see here https://medium.com/nerd-for-tech/setup-jacoco-code-coverage-with-your-multimodule-android-app-kotlin-a0f82573a1 | |
exclude file agregation here https://liviutudor.com/2016/02/11/jacoco-gradle-excluding-source-files-and-classes/ |
OlderNewer