Skip to content

Instantly share code, notes, and snippets.

View fauzisho's full-sized avatar
🏠
Working from home

fauzisho fauzisho

🏠
Working from home
View GitHub Profile
import numpy as np
import random
import matplotlib.pyplot as plt
# Define the coordinates of cities
city_names = ["Gliwice", "Cairo", "Rome", "Krakow", "Paris", "Alexandria", "Berlin", "Tokyo", "Hong Kong", "Rio"]
x = [0, 3, 6, 7, 15, 10, 16, 5, 8, 1.5]
y = [1, 2, 1, 4.5, -1, 2.5, 11, 6, 9, 12]
city_coords = dict(zip(city_names, zip(x, y)))
import numpy as np
import pandas as pd
# Define the Perceptron class (reuse the provided implementation)
class Perceptron:
def __init__(self, n_features, learning_rate=0.01, n_iters=100, initial_weights=None):
# Initialize weights with provided values or small random values between -1 and 1
if initial_weights is not None:
self.weights = np.array(initial_weights)
else:
-> Android manifest
<service
android:name=".service.LocationService"
android:enabled="true"
android:exported="true" />
-----------------------------------------------------------------------------------------------------------------
-> public class locationSevices
-> Android manifest
<service
android:name=".service.LocationService"
android:enabled="true"
android:exported="true" />
-----------------------------------------------------------------------------------------------------------------
-> public class locationSevices
-> Android manifest
<service
android:name=".service.LocationService"
android:enabled="true"
android:exported="true" />
-----------------------------------------------------------------------------------------------------------------
-> public class locationSevices
@fauzisho
fauzisho / set color in ViewHolder
Created February 22, 2019 16:13
set color in ViewHolder
ViewHolder (Kotlin)
val rlBackground = itemView.findViewById<RelativeLayout>(R.id.rlBackground)
// init color parse
Int color = Color.parseColor("#ff0000")
// init background color
rlBackground.setBackgroundColor(check)
imageView.image = Qiscus.image(named: "ar_record")?.withRenderingMode(.alwaysTemplate)
imageView.layer.cornerRadius = 42
imageView.clipsToBounds = true
imageView.tintColor = UIColor.red
imageView.backgroundColor = UIColor.white
a: [866, 7920, 5963, 194, 262, 8640, 4270, 4677, 4496, 9983, 4757, 5561, 4330, 4293, 1729, 6863, 4856, 385, 6528, 2557, 6466, 9925, 3908, 3334, 8456, 2636, 2115, 2399, 3582, 5177, 6277, 7729, 9504, 3436, 6132, 1891, 5826, 8201, 1367, 9537, 6238, 7177, 3577, 7404, 6402, 2109, 6541, 8948, 4178, 1890, 686, 1919, 625, 7936, 5426, 5514, 6433, 7422, 8870, 3995, 2800, 4755, 3424, 2561, 124, 5007, 6171, 5142, 5830, 7374, 2192, 7624, 9092, 419, 5382, 1602, 214, 51, 5994, 4155, 7945, 9545, 3569, 5550, 6377, 6726, 2259, 8703, 6729, 6429, 6138, 5074, 256, 497, 8635, 4092, 6835, 1833, 3868, 6741, 9833, 5406, 6762, 141, 4322, 7555, 4104, 6494, 9568, 509, 9700, 3886, 5164, 6082, 9390, 1915, 5022, 4411, 3422, 9844, 1970, 3730, 9694, 697, 8820, 1819, 3160, 9549, 5344, 4167, 6639, 4417, 3009, 925, 5563, 7686, 8262, 3895, 9214, 6311, 2834, 914, 8317, 9163, 5388, 6638, 192, 8396, 5940, 2648, 2959, 462, 4597, 9453, 8993, 9706, 9599, 362, 9865, 3701, 4113, 4191, 1617, 3811, 3766, 5812, 7723, 6352, 3676, 6938, 8040, 7493, 412, 9138
@fauzisho
fauzisho / open.java
Created November 21, 2017 07:10
openchatroom from notif
Qiscus.getChatConfig().setNotificationClickListener(new NotificationClickListener() {
@Override
public void onClick(final Context context, QiscusComment qiscusComment) {
QiscusChatRoom savedRoom = Qiscus.getDataStore().getChatRoom(qiscusComment.getRoomId());
if (savedRoom != null) {
openChatroom(context, savedRoom);
} else {
QiscusApi.getInstance()
.getChatRoom(qiscusComment.getRoomId())
.subscribeOn(Schedulers.io())
@fauzisho
fauzisho / qiscusfirebaseservice.java
Created October 27, 2017 06:31
set qiscus firebase token
public class FirebaseService extends QiscusFirebaseService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> data = remoteMessage.getData();
Log.d("onMessageReceived", "onMessageReceived: " + data.toString());
if (QiscusFirebaseService.handleMessageReceived(remoteMessage)) { // SDK PN, contains key qiscus_sdk