Skip to content

Instantly share code, notes, and snippets.

View mufti1's full-sized avatar
❤️

Mufti ismi rizqi mufti1

❤️
View GitHub Profile
╔══════════╦═══════════════════╦══════════════════════════════════════════════════════════════════════════╦════════════════════════╦════════════════════════════════════╦════════════════════════╗
║ Operator ║ Tipe Data Operand ║ Deskripsi ║ Contoh Data ║ Contoh penggunaan Operator ║ Hasil ║
╠══════════╬═══════════════════╬══════════════════════════════════════════════════════════════════════════╬════════════════════════╬════════════════════════════════════╬════════════════════════╣
║ @> ║ jsonb ║ Apakah nilai x ada di data JSON? ║ {"a":1, "b":2}' ║ ::jsonb @> '{"b":2}'::jsonb ║ {"a":1, "b":2}' ║
║ <@ ║ jsonb ║ Apakah nilai data JSON mengandung nilai x ? ║ {"b":2}' ║ ::jsonb <@ '{"a":1, "b":2}'::jsonb ║ {"b":2}' ║
║ ? ║ text ║ Apakah key terat
╔══════════╦═══════════════════╦═══════════════════════════════════════════════════════════════════════════╦══════════════════════════════════════╦════════════════════════════╦═════════════════╗
║ Operator ║ Tipe Data Operand ║ Deskripsi ║ Contoh Data ║ Contoh penggunaan Operator ║ Hasil ║
╠══════════╬═══════════════════╬═══════════════════════════════════════════════════════════════════════════╬══════════════════════════════════════╬════════════════════════════╬═════════════════╣
║ -> ║ int ║ Mendapatkan data dengan index spesifik ║ [1,2,3] ║ -> 0 ║ 1 ║
║ -> ║ text ║ Mendapatkan data berdasarkan key ║ {"a":"foo"},{"b":"bar"},{"c":"baz"}' ║ -> 'a' ║ {"a":"foo"} ║
║ ->> ║ int ║ Mendapatkan data
#!/bin/bash
apt update
apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install docker-ce -y
class TollGate
def initialize(card)
@status = 0
end
def open_gate
@status = 1
end
def close_gate
class TollGate
def initialize(card, balance)
@status = 0
@card = card
@balance = balance
end
def read_card
true if @card == 'toll-card'
false
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
using namespace std;
struct exam {
char examName[40];
char examCode[5];
int date;
package consumer
import (
"os"
"github.com/Shopify/sarama"
"github.com/sirupsen/logrus"
)
// KafkaConsumer hold sarama consumer
package consumer_test
import (
"os"
"testing"
"time"
"github.com/Shopify/sarama"
"github.com/Shopify/sarama/mocks"
"github.com/mufti1/kafka-example/consumer"
@mufti1
mufti1 / main.go
Created March 5, 2019 09:56
publiser main
package main
import (
"fmt"
"time"
"github.com/Shopify/sarama"
"github.com/mufti1/kafka-example/producer"
"github.com/sirupsen/logrus"
)
package producer
import (
"github.com/Shopify/sarama"
"github.com/sirupsen/logrus"
)
// KafkaProducer hold kafka producer session
type KafkaProducer struct {
Producer sarama.SyncProducer