Skip to content

Instantly share code, notes, and snippets.

View ferdhika31's full-sized avatar
:octocat:
Home

Ferdhika Yudira ferdhika31

:octocat:
Home
View GitHub Profile
@febritecno
febritecno / main.js
Created March 29, 2020 09:28
contoh bot wa tanpa API (whatsapp-web.js)
const { Client } = require('whatsapp-web.js');
const qrCode = require('qrcode');
const http = require('http');
const request = require('request');
const client = new Client();
const stop = "\n\n===============\nBalas pesan ini dengan *stop* untuk berhenti automasi Covid19"
const penggunaAksi = new Map();
@SHi-ON
SHi-ON / stratify_experiment.py
Created March 10, 2019 17:08
An expirement to show how stratify option works
# Experiment to confirm the effect of stratify option in Scikit Learn, tran_test_split() method.
# by Shayan Amani
from sklearn.model_selection import train_test_split
import pandas as pd
raw_data = pd.read_csv("codebase/adrel/dataset/train.csv")
cnt = raw_data.groupby('label').count()
''' experiment begins '''
@troatie
troatie / CreatesWithLock.php
Last active September 12, 2023 13:51
Guard against race conditions in Laravel's firstOrCreate and updateOrCreate
trait CreatesWithLock
{
public static function updateOrCreate(array $attributes, array $values = [])
{
return static::advisoryLock(function () use ($attributes, $values) {
// emulate the code found in Illuminate\Database\Eloquent\Builder
return (new static)->newQuery()->updateOrCreate($attributes, $values);
});
}
@SastraNababan
SastraNababan / serialParalel.js
Created November 1, 2017 06:11
Async/await serial vs paralel
const firstPromise= () => (new Promise((resolve,reject) => {
setTimeout(() =>{ resolve('first Promise')},1000)
}))
const secondPromise = () => ( new Promise((resolve,reject) =>{
setTimeout(() =>{ resolve('second Promise')},1000)
}))
const thirdPromise = () => ( new Promise((resolve,reject) =>{
@guipmourao
guipmourao / ubuntu16.04-command-line-install-android-sdk
Created March 15, 2017 12:17
Ubuntu 16.04 command line install android sdk
# create sdk folder
export ANDROID_HOME=/opt/android-sdk-linux
sudo mkdir -p $ANDROID_HOME
# install openjdk
sudo apt-get install openjdk-8-jdk
# download android sdk
cd $ANDROID_HOME
sudo wget https://dl.google.com/android/repository/tools_r25.2.3-linux.zip
Corpus
>> from nltk.corpus import brown
>>> brown.words()[0:10]
sentence & word tokenization
part-of-speech tagging
chunking & named entity recognition
text classification
many included corpora
anonymous
anonymous / slim-api.php
Created February 20, 2016 06:53
Solved Ionic + Slim
<?php
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']) && (
$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'POST' ||
$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'DELETE' ||
$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] == 'PUT' )) {
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Credentials: true");
header('Access-Control-Allow-Headers: X-Requested-With');
header('Access-Control-Allow-Headers: Content-Type');
@parmentf
parmentf / GitCommitEmoji.md
Last active April 30, 2024 17:34
Git Commit message Emoji
@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ