Skip to content

Instantly share code, notes, and snippets.

View 4sskick's full-sized avatar
🏠
Working from home

tian 4sskick

🏠
Working from home
View GitHub Profile
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
@4sskick
4sskick / 'let' + 'const' equivalent in ES5
Created September 4, 2016 20:36
'let' + 'const' equivalent in ES5
As we knew that 'let & const' are not coming in ES5, those are coming in ES6 since 2015.
So to make these work like in latest version ECMA Scripts 2015, we can define it by ourself.
'const' - ES6
const a = 1;
'const' - ES5
var a = (function(){
var a = 1;
return function(){
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"
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;
@4sskick
4sskick / pick random element list java
Last active August 15, 2019 07:21
this methods useful whenever you build dummy data using model
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);
#!/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
#!/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
@4sskick
4sskick / KoinJavaUtils.kt
Created July 18, 2020 10:46 — forked from fredy-mederos/KoinJavaUtils.kt
Koin java utility functions to inject components and properties in java classes.
package com.common.utils
import org.koin.KoinContext
import org.koin.standalone.StandAloneContext
import kotlin.jvm.internal.Reflection
/**
* @author @fredy_mederos
*/
@4sskick
4sskick / Transfer repo from X to Y
Last active November 17, 2021 08:37 — forked from mandiwise/Update remote repo
Transfer repo from Bitbucket to Github
// Reference: http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/
// See also: http://www.paulund.co.uk/change-url-of-git-repository
$ cd to old repo folder
$ git remote rename origin bitbucket
$ git remote add origin https://github.com/account/new-repo.git
$ git push origin master
$ git remote rm bitbucket
@4sskick
4sskick / nvm setup with windows 10
Created October 4, 2021 04:43
NVM setup with windows 10
- 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