Skip to content

Instantly share code, notes, and snippets.

View katipogluMustafa's full-sized avatar
🎯
Focusing

Mustafa Katipoğlu katipogluMustafa

🎯
Focusing
View GitHub Profile
@katipogluMustafa
katipogluMustafa / apply.c
Created February 7, 2022 17:44
Random code fragment from git source code
/*
A small part of 200 lines long function from Git source code.
*/
if (inaccurate_eof &&
old > oldlines && old[-1] == '\n' &&
newlines.len > 0 && newlines.buf[newlines.len - 1] == '\n') {
old--;
strbuf_setlen(&newlines, newlines.len - 1);
preimage.line_allocated[preimage.nr - 1].len--;
postimage.line_allocated[postimage.nr - 1].len--;
@katipogluMustafa
katipogluMustafa / configure_android_amazon_cloud_postgresql_connection.java
Created January 22, 2022 08:54
Android Amazon Cloud PostgreSQL Connection Configuration
private final String host = "ssprojectinstance.csv2nbvvgbcb.us-east-2.rds.amazonaws.com"
private final String database = "postgres";
private final int port = 5432;
private final String user = "postgres";
private final String pass = "123456";
@katipogluMustafa
katipogluMustafa / configure_android_google_cloud_postgresql_connection.java
Created January 22, 2022 08:54
Android Google Cloud PostgreSQL Connection Configuration
private final String host = "35.44.16.169";
private final String database = "postgres";
private final int port = 5432;
private final String user = "postgres";
private final String pass = "123456";
@katipogluMustafa
katipogluMustafa / configure_android_localhost_postgresql_connection.java
Created January 22, 2022 08:54
Android Local PostgreSQL Connection Configuration
private final String host = "10.0.2.2";
private final String database = "postgres";
private final int port = 5432;
private final String user = "postgres";
private final String pass = "123456";
{% for k,v in story_content.items %}
{{ k }} # request.POST dictionary key
{{ v | safe }}
{% endfor %}
<!DOCTYPE html>
<html>
<head>
{% load static %}
<script src="{% static 'tinymce/tinymce.min.js' %}" referrerpolicy="origin"></script>
<style>
.demo-dfree {
position: relative;
width: 690px;
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.2);
<form class='demo-dfree' method="post">
{% csrf_token %}
<header>
<h1 class="dfree-header mce-content-body" contenteditable="true" style="position: relative;" spellcheck="false">
{{ story.title }}
</h1>
<br/>
<p class="dfree-description mce-content-body" contenteditable="true" style="position: relative;" spellcheck="false">
{{ story.description }}
@katipogluMustafa
katipogluMustafa / django_tinymce_non_input_form.py
Last active December 16, 2021 17:05
Django retrival of Tinymce non-input fields from a HTML form
def edit_story(request, story_id):
if request.method == "POST":
title = request.POST["mce_0"]
description = request.POST["mce_2"]
content = request.POST["mce_3"]
update_story_object(story_id, title, description, content)
return redirect("show_story_page", story_id)
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
// gcc mocking.c -Wl,--wrap=rand -o mocking.exe
int __wrap_rand()
{
return 5;
@katipogluMustafa
katipogluMustafa / variadic_arguments.c
Created May 27, 2021 08:40
Variadic arguments fail when they get less than expected number of parameters.
#include <stdio.h>
#include <stdarg.h>
int process(int param, va_list var_args)
{
printf("\nThe First Param : %d", param);
char* name = va_arg(var_args, char*);
if(NULL != name)
printf(" \nThe String Param I Expect : %s", name);