Skip to content

Instantly share code, notes, and snippets.

Avatar
🤍
Code is part of my art. Code with Love.

Bervianto Leo Pratama berviantoleo

🤍
Code is part of my art. Code with Love.
View GitHub Profile
View nginx-service.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
type: NodePort
selector:
app: nginx
ports:
# By default and for convenience, the `targetPort` is set to the same value as the `port` field.
@berviantoleo
berviantoleo / Vagrantfile
Created Jul 11, 2021
Vagrantfile Alpine
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@berviantoleo
berviantoleo / check-list-pass.py
Created Sep 7, 2020
Check List Password Duplication
View check-list-pass.py
def checkIfDuplicates(listOfElems):
''' Check if given list contains any duplicates '''
setOfElems = set()
for elem in listOfElems:
if elem in setOfElems:
return True
else:
setOfElems.add(elem)
return False
@berviantoleo
berviantoleo / pass-gen.py
Created Sep 7, 2020
Simple Password Generator Python
View pass-gen.py
import string
import secrets
import sys
alphabet = string.ascii_letters + string.digits
def generatePass():
while True:
password = ''.join(secrets.choice(alphabet) for i in range(10))
if (any(c.islower() for c in password)
and any(c.isupper() for c in password)
@berviantoleo
berviantoleo / fgets_example.c
Last active May 5, 2020
Example to use fgets.
View fgets_example.c
#include <stdio.h>
int main() {
char str1[5];
if(fgets (str1, 5, stdin) != NULL) {
/* writing content to stdout */
printf("%s", str1);
}
return 0;
}
@berviantoleo
berviantoleo / gets_example.c
Created Dec 6, 2017
Using Gets for User Input.
View gets_example.c
#include <stdio.h>
int main() {
char str1[5];
gets(str1);
printf("%s", str1);
return 0;
}
@berviantoleo
berviantoleo / scanf_example_2.c
Created Dec 6, 2017
Standart Input Scanf in C with limit the length of input.
View scanf_example_2.c
#include <stdio.h>
int main() {
char str1[5];
scanf("%5s", str1);
printf("%s", str1);
return 0;
}
@berviantoleo
berviantoleo / scanf_example_1.c
Created Dec 6, 2017
Standart Input Scanf in C without limit the length of input.
View scanf_example_1.c
#include <stdio.h>
int main() {
char str1[5];
scanf("%s", str1);
printf("%s", str1);
return 0;
}
@berviantoleo
berviantoleo / sms-spam-filtering.py
Last active Sep 7, 2017
Naive Bayes & SVM for SMS SPAM FILTERING (Python)
View sms-spam-filtering.py
import matplotlib.pyplot as plt
import csv
from textblob import TextBlob
import pandas
import sklearn
import pickle
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.svm import SVC, LinearSVC