Skip to content

Instantly share code, notes, and snippets.

View marty0678's full-sized avatar

Marty Cochrane marty0678

  • Lead Software Engineer for Disguise.
  • Stratford, ON
View GitHub Profile
@MattJeanes
MattJeanes / GitHubCopilotCLIAlias.ps1
Last active February 5, 2024 09:06
Alias commands to use GitHub Copilot CLI in PowerShell
# You should insert this script into your PowerShell Profile script so it exists in every session
# Fun fact: This script was mostly generated by ChatGPT by giving it the bash version of the output
# from `github-copilot-cli alias -- "$0"` with a few fixes from me
function Invoke-CopilotWhatTheShell {
$TMPFILE = New-TemporaryFile;
try {
github-copilot-cli what-the-shell $args --shellout $TMPFILE
if ($LASTEXITCODE -eq 0) {
@gilbitron
gilbitron / CaddyController.php
Created June 16, 2021 10:55
Enabling HTTPS (SSL) for Laravel Sail using Caddy
<?php
# app/Http/Controllers/CaddyController.php
namespace App\Http\Controllers;
use App\Store;
use Illuminate\Http\Request;
class CaddyController extends Controller
{
@rluts
rluts / token_auth.py
Last active October 13, 2023 20:56
Token authorization middleware for Django Channels 2
from channels.auth import AuthMiddlewareStack
from rest_framework.authtoken.models import Token
from django.contrib.auth.models import AnonymousUser
from django.db import close_old_connections
class TokenAuthMiddleware:
"""
Token authorization middleware for Django Channels 2
"""
@AndrewPix
AndrewPix / serializers.py
Last active January 3, 2024 14:23
Integrate django-rest-knox with django-rest-auth
from rest_framework import serializers
from rest_auth.serializers import UserDetailsSerializer
class KnoxSerializer(serializers.Serializer):
"""
Serializer for Knox authentication.
"""
token = serializers.CharField()
@wadewegner
wadewegner / CreateCustomField.xml
Created February 21, 2014 17:58
Examples of HTTP requests and responses for Salesforce SOAP and Metadata API calls.
POST https://na15.salesforce.com/services/Soap/m/29.0/00Di0000000icUB HTTP/1.1
SOAPAction: create
Content-Type: text/xml; charset=utf-8
Host: na15.salesforce.com
Content-Length: 894
Expect: 100-continue
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:apex="http://soap.sforce.com/2006/08/apex" xmlns:cmd="http://soap.sforce.com/2006/04/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>