Skip to content

Instantly share code, notes, and snippets.

View ademkocamaz's full-sized avatar

Adem KOCAMAZ ademkocamaz

View GitHub Profile
@ademkocamaz
ademkocamaz / hl7mlp_receiver.js
Created July 17, 2023 21:16 — forked from palefailmel/hl7mlp_receiver.js
A simple node.js HL7 MLP server. Saves messages in files in a local folder, and generates ACK to send back to application.
/*
Author: Michael Stevenson
Date : 2014/09/03
Desc : Receive HL7 message from an MLP tcp interface on a specific port and ip.
Saves message to folder on PC. Constructs and sends ACK back to interface
*/
var net = require('net');
var fs = require('fs');
@ademkocamaz
ademkocamaz / visualstudio2019Key.txt
Created August 20, 2023 14:08
Visual Studio 2019 Product Key
Visual Studio 2019 Product Key
[Please Star this gist]
**Follow Me On Instagram -->> https://www.instagram.com/ahtazaz_mughal/**
Whatsapp +923451525359
Visual Studio 2019 Enterprise
<?php
// Initilise cURL
$ch = curl_init();
// Set the cURL Options
$optArray = array(
CURLOPT_URL => 'https://example.com/api/getInfo/',
CURLOPT_RETURNTRANSFER => true
);
@ademkocamaz
ademkocamaz / simplexml-curl-feed-fetch.php
Created August 28, 2023 15:50 — forked from deepak-rajpal/simplexml-curl-feed-fetch.php
Fetch XML Feeds using cURL and SimpleXML - Best and Tested
<?php
/* Fetch XML feeds using PHP SimpleXML and cURL */
/* Step 1) Parse xml url in curl and assign all data into a variable
Step 2) Pass Xml data into SimpleXML and access elements using returned object */
/* =================The SimpleXML =========================
The SimpleXML extension provides a very simple and easily usable toolset to convert XML to an object that can be processed with normal property selectors and array iterators.
This extension requires the libxml PHP extension. This means that passing in --enable-libxml is also required, although this is implicitly accomplished because libxml is enabled by default. The SimpleXML extension requires PHP 5.
@ademkocamaz
ademkocamaz / scorched_earth.sh
Created September 25, 2023 18:08 — forked from adamghill/scorched_earth.sh
Start from scratch for database migrations in Django
#!/bin/sh
set -e
die () {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "Database name argument is required"
@ademkocamaz
ademkocamaz / admin.py
Created September 25, 2023 22:15 — forked from lc-thomas/admin.py
Django custom admin site with list_display, tabular inline data, custom templates and custom view
from django.contrib import admin
from django.contrib.admin.models import LogEntry
from django.db.models import ManyToOneRel, ForeignKey, OneToOneField
from django.apps import apps
from django.contrib.auth.models import Group, User
from django.contrib.auth.admin import GroupAdmin, UserAdmin
from django.conf.urls import url
# admin custom views
from . import admin_views
@ademkocamaz
ademkocamaz / customize-save-in-django-admin-inline-form.org
Created September 28, 2023 04:47 — forked from shymonk/customize-save-in-django-admin-inline-form.org
How to customize save in django admin inline form?

Customize Save In Django Admin Inline Form

Background

This is a common case in django ORM.

from django.db import models

class Author(models.Model):
@ademkocamaz
ademkocamaz / README.md
Created October 6, 2023 15:48 — forked from rduplain/README.md
Connect to MSSQL using FreeTDS / ODBC in Python.

Goal: Connect to MSSQL using FreeTDS / ODBC in Python.

Host: Ubuntu 11.10 x86_64

Install:

sudo apt-get install freetds-dev freetds-bin unixodbc-dev tdsodbc
pip install pyodbc sqlalchemy

In /etc/odbcinst.ini:

@ademkocamaz
ademkocamaz / macos-pyodbc-freetds-mssql-django.md
Created October 6, 2023 16:45 — forked from tiagoad/macos-pyodbc-freetds-mssql-django.md
macOS Mojave + pyodbc + FreeTDS + SQL Server + Django 2.2

pyODBC + FreeTDS

  1. Run brew install unixodbc freetds
  2. Add section to /usr/local/etc/odbcinst.ini:
    [FreeTDS]
    Description     = FreeTDS unixODBC Driver
    Driver          = /usr/local/lib/libtdsodbc.0.so
    Setup           = /usr/local/lib/libtdsodbc.0.so
    UsageCount      = 1
@ademkocamaz
ademkocamaz / get_field_verbose_name.py
Created October 15, 2023 10:33 — forked from jmorakuebler/get_field_verbose_name.py
Custom django template tag that returns the verbose name of a field.
from django.template import Library
register = Library()
@register.simple_tag
def get_field_verbose_name(instance, field_name):
"""Returns the verbose_name of the specified field."""
return instance._meta.get_field(field_name).verbose_name.title()