Skip to content

Instantly share code, notes, and snippets.

View DarkcoderSe's full-sized avatar
:octocat:
Focusing

Dark Coder DarkcoderSe

:octocat:
Focusing
View GitHub Profile
[
{
"label": "🤐 Rather not to say",
"value": "Rather not to say",
"active": true
},
{
"label": "🤷‍♂️ Other",
"value": "Other"
},
@DarkcoderSe
DarkcoderSe / chat_example_django.py
Last active June 8, 2023 10:45
Django Channels Chat Exmaple with DB.
# routing.py file
# room_name is consist of conversation.id where sender and receiver is saved
path(r"ws/chat/<str:room_name>", consumers.ChatConsumer.as_asgi()),
# consumers.py file
class ChatConsumer(WebsocketConsumer):
def connect(self):
print("here")
<?php
$arrayOfObjects = [
[
'id' => 10,
'name' => 'John',
'age' => 20
],
[
'id' => 2,
<?php
$passengerCount = 51;
function calculateVehicles($passengers) : void {
echo ceil($passengers / 5);
}
calculateVehicles($passengerCount);
@DarkcoderSe
DarkcoderSe / medications_index_pattern.sh
Created February 17, 2022 06:46
Medications ( Product NDC ) List Index Pattern
curl -X PUT 'http://localhost:9200/medications-v1?pretty' -H 'Content-Type: application/json' -d '{
"mappings": {
"properties": {
"product_ndc": { "type": "text" },
"product_type_name": { "type": "text" },
"proprietary_name": { "type": "text" },
"proprietary_name_suffix": { "type": "text" },
"non_proprietary_name": { "type": "text" },
"id": { "type": "keyword" },
"product_id": { "type": "keyword" },
@DarkcoderSe
DarkcoderSe / esi_cpt_index.sh
Created November 15, 2021 07:11
ESI_CPT Index pattern ( Master List Data )
curl -X PUT 'http://localhost:9200/cpt-index-name?pretty' -H 'Content-Type: application/json' -d '{
"mappings": {
"properties": {
"id": { "type": "long" },
"cpt_code": { "type": "keyword" },
"description": { "type": "text" }
}
}
}'
@DarkcoderSe
DarkcoderSe / esi_hospital_index.sh
Created November 15, 2021 07:09
ESI_HOSPITAL ( hospitals data with coords )
curl -X PUT 'http://localhost:9200/hospitals-index-name?pretty' -H 'Content-Type: application/json' -d '{
"mappings": {
"properties": {
"address" : {
"type" : "text"
},
"city" : {
"type" : "keyword"
},
"emergency_services" : {
@DarkcoderSe
DarkcoderSe / esi_procedure_index_pattern.sh
Created November 15, 2021 07:01
ESI_PROCEDURE Index pattern.
curl -X PUT 'http://localhost:9200/procedure-index-name?pretty' -H 'Content-Type: application/json' -d '{
"mappings": {
"properties": {
"id": { "type": "long" },
"facility_id": { "type": "keyword" },
"code": { "type": "keyword" },
"address": { "type": "text" },
"city": { "type": "keyword" },
"code_original": { "type": "keyword" },
"emergency_services": { "type": "keyword" },
input {
jdbc {
jdbc_driver_library => "/path-to-jdbc/mysql-connector-java-8.0.26/mysql-connector-java-8.0.26.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://ip:port/db"
jdbc_user => 'user'
jdbc_password => 'password'
jdbc_paging_enabled => true
schedule =>"* * * * *"
statement => "SELECT cdm_uq.id, cdm_uq.facility_id, cdm_uq.code, cdm_uq.description, cdm_uq.price, cdm_uq.code_original, hospitals.facility_name, hospitals.address, hospitals.city, hospitals.state, hospitals.zip_code, hospitals.phone_number, hospitals.hospital_type, hospitals.emergency_services, hospitals.hospital_overall_rating, hospitals.latitude, hospitals.longitude FROM `cdm_uq` JOIN `hospitals` ON cdm_uq.facility_id = hospitals.facility_id WHERE cdm_uq.id > :sql_last_value"
## ESI_PROCEDURE Index Pattern
curl -X PUT 'http://localhost:9200/caf-v1?pretty' -H 'Content-Type: application/json' -d '{
"mappings": {
"properties": {
"id": { "type": "long" },
"facility_id": { "type": "keyword" },
"code": { "type": "keyword" },
"address": { "type": "text" },
"city": { "type": "keyword" },