Skip to content

Instantly share code, notes, and snippets.

View ademkocamaz's full-sized avatar

Adem KOCAMAZ ademkocamaz

View GitHub Profile
@hehuan2112
hehuan2112 / install-xrdp-ubuntu-18.04.md
Last active July 8, 2024 20:07
Install Remote Desktop (xRDP) for Ubuntu Server 18.04

Install Remote Desktop (xRDP) for Ubuntu Server 18.04

Step 1 – Install xRDP:

sudo apt update
sudo apt install xrdp

Step 2 – Install XFCE4

sudo apt install xfce4

@jjuanrivvera99
jjuanrivvera99 / mssql-docker-compose.yml
Last active April 13, 2025 08:06
SQL Server with Docker Compose
version: '3.3'
services:
mssql:
container_name: sql-server
image: mcr.microsoft.com/mssql/server:2017-latest
#image: mcr.microsoft.com/mssql/server:2017-CU11-ubuntu
restart: always
environment:
ACCEPT_EULA: "Y"
@tiagoad
tiagoad / macos-pyodbc-freetds-mssql-django.md
Last active October 6, 2023 16:45
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
@lc-thomas
lc-thomas / admin.py
Last active September 25, 2023 22:15
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
@jmorakuebler
jmorakuebler / get_field_verbose_name.py
Created November 13, 2019 13:11
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()
<?php
// Initilise cURL
$ch = curl_init();
// Set the cURL Options
$optArray = array(
CURLOPT_URL => 'https://example.com/api/getInfo/',
CURLOPT_RETURNTRANSFER => true
);
@tkuenneth
tkuenneth / MainActivity.kt
Created May 29, 2021 10:07
How to display an adaptive icon in Jetpack Compose
package com.thomaskuenneth.sandbox
import android.graphics.Bitmap
import android.graphics.Canvas
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
@idleberg
idleberg / vscode-macos-context-menu.md
Last active July 21, 2025 01:53
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
@adamghill
adamghill / scorched_earth.sh
Last active September 25, 2023 18:08
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"
@diyinfosec
diyinfosec / 01-aes-bruteforce.py
Created January 25, 2022 19:36
Brute-force AES-256 keys from memory dump.
from timeit import default_timer as timer
from binascii import b2a_hex
#- Config variables
filename="memory.dmp"
aes_key_size=32
#- Variables related to file processing
file_offset=0;
total_keys_found = 0;