Skip to content

Instantly share code, notes, and snippets.


Mesut Taşçı mesuutt

View GitHub Profile
mesuutt /
Last active Jun 2, 2022
rename kubeconfig files with cluster name
# alias kctx="source ~/.bin/"
file=$(ls -1 $CONF_DIR | fzf)
echo "$file"
if [[ ! "$file" == "null" ]]; then
View logrus.go
// formatter adds default fields to each log entry.
type formatter struct {
Fields logrus.Fields
Lf logrus.Formatter
// Format satisfies the logrus.Formatter interface.
func (f *formatter) Format(e *logrus.Entry) ([]byte, error) {
for k, v := range f.Fields {
e.Data[k] = v
mesuutt /
Last active Feb 14, 2021
actix-web(3) logging middleware with slog (2.7)
use actix_service::{Service, Transform};
use actix_web::{dev::ServiceRequest, dev::ServiceResponse, Error};
use futures::future::{ok, Ready};
use futures::{Future};
use slog::info;
use futures::task::Poll;
use std::task::Context;
use std::pin::Pin;
mesuutt /
Created Nov 14, 2020 — forked from MauricioMoraes/
Allow Docker Container Access to Host's Postgres Database on linux (ubuntu)

You have to do 2 things in order to allow your container to access your host's postgresql database

  1. Make your postgresql listen to an external ip address
  2. Let this client ip (your docker container) access your postgresql database with a given user

Obs: By "Host" here I mean "the server where docker is running on".

Make your postgresql listen to an external ip address

Find your postgresql.conf (in case you don't know where it is)

$ sudo find / -type f -name postgresql.conf

View nested_scroll_demo.dart
import 'package:flutter/material.dart';
void main() async {
runApp(new TestApp());
class TestApp extends StatelessWidget {
Widget build(BuildContext context) {
View nested_scroll_view.dart
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() {
runApp(new TestApp());
mesuutt / format-money.dart
Last active Feb 11, 2019
Format money as Turkish money format in dart language
View format-money.dart
String formatMoney(dynamic text) {
if (text is num){
text = text.toStringAsFixed(2);
return text
.replaceAllMapped(RegExp(r"(\d)(?=(\d{3})+\.)"), (m) => "${}.")
.replaceAllMapped(RegExp(r"\.(\d+)$"), (m) => ",${}");
mesuutt /
Last active Oct 25, 2018
Django save file to storage & Read from storage without model
from import default_storage
# Saving POST'ed file to storage
file = request.FILES['myfile']
filename =, file)
# Reading file from storage
file =
mesuutt /
Last active Nov 9, 2021
Kullanisli Postgresql Sorgulari
mesuutt / ajax-setup.js
Last active May 2, 2022
Django handling expired session (for ajax request)
View ajax-setup.js
complete: function(xhr, status) {
if(xhr.status == 278) {
if (xhr.responseJSON) {
var data = xhr.responseJSON;
if (!data.success && data.error_message) {