Skip to content

Instantly share code, notes, and snippets.

View berviantoleo's full-sized avatar
❤️
Coding with love.

Bervianto Leo Pratama berviantoleo

❤️
Coding with love.
View GitHub Profile
@berviantoleo
berviantoleo / sms-spam-filtering.py
Last active September 7, 2017 17:44
Naive Bayes & SVM for SMS SPAM FILTERING (Python)
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
@berviantoleo
berviantoleo / scanf_example_1.c
Created December 6, 2017 11:51
Standart Input Scanf in C without limit the length of input.
#include <stdio.h>
int main() {
char str1[5];
scanf("%s", str1);
printf("%s", str1);
return 0;
}
@berviantoleo
berviantoleo / scanf_example_2.c
Created December 6, 2017 11:57
Standart Input Scanf in C with limit the length of input.
#include <stdio.h>
int main() {
char str1[5];
scanf("%5s", str1);
printf("%s", str1);
return 0;
}
@berviantoleo
berviantoleo / gets_example.c
Created December 6, 2017 12:25
Using Gets for User Input.
#include <stdio.h>
int main() {
char str1[5];
gets(str1);
printf("%s", str1);
return 0;
}
@berviantoleo
berviantoleo / fgets_example.c
Last active May 5, 2020 10:06
Example to use fgets.
#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 / pass-gen.py
Created September 7, 2020 00:52
Simple Password Generator Python
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 / check-list-pass.py
Created September 7, 2020 00:55
Check List Password Duplication
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 / Vagrantfile
Created July 11, 2021 05:14
Vagrantfile Alpine
# -*- 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 / nginx-service.yaml
Created July 11, 2021 05:47
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.