Skip to content

Instantly share code, notes, and snippets.

View MarcDufresne's full-sized avatar
👌

Marc-André Dufresne MarcDufresne

👌
View GitHub Profile
@MarcDufresne
MarcDufresne / profile.py
Created March 3, 2021 20:37
Python Memory Snapshot Profiler
def profile(message: str = "Snapshot"):
padding_len = max(99 - len(message), 0)
print(f"{message} {'*' * padding_len}")
import pandas
from pympler import muppy, summary
all_objects = muppy.get_objects()
sum1 = summary.summarize(all_objects)
# Prints out a summary of the large objects
summary.print_(sum1)
@MarcDufresne
MarcDufresne / Dockerfile
Created December 14, 2020 17:00
Kong Custom Plugin Image
FROM kong:2.2
USER root
RUN luarocks install kong-auth-request
USER kong
@MarcDufresne
MarcDufresne / docker-compose.yaml
Created November 6, 2020 00:08
Teslamate Docker Compose
version: "3"
services:
teslamate:
image: teslamate/teslamate:latest
restart: always
depends_on:
- database
environment:
- DATABASE_USER=${TM_DB_USER}
@MarcDufresne
MarcDufresne / custom_feed.py
Last active August 21, 2020 11:34
Custom XML Feed in Django
# -*- coding: utf-8 -*-
"""
Custom Django Feed
"""
from django.contrib.syndication.views import Feed
from django.utils.feedgenerator import SyndicationFeed
from django.utils.xmlutils import SimplerXMLGenerator
class CustomSyndicationFeed(SyndicationFeed):
Param(
[alias('n')]
[string]$taskName,
[alias('s')]
[string]$scriptLocation,
[alias('d')]
[switch]$deleteTask,
[alias('h')]
[switch]$help
)
@MarcDufresne
MarcDufresne / d2_solo.ps1
Created September 3, 2019 16:41
Destiny 2 Solo Mode
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs; exit }
New-NetFirewallRule -DisplayName "Destiny2-Solo-1" -Direction Outbound -LocalPort 1935,3097,3478-3480 -Protocol TCP -Action Block
New-NetFirewallRule -DisplayName "Destiny2-Solo-2" -Direction Outbound -LocalPort 1935,3097,3478-3480 -Protocol UDP -Action Block
New-NetFirewallRule -DisplayName "Destiny2-Solo-3" -Direction Inbound -LocalPort 1935,3097,3478-3480 -Protocol TCP -Action Block
New-NetFirewallRule -DisplayName "Destiny2-Solo-4" -Direction Inbound -LocalPort 1935,3097,3478-3480 -Protocol UDP -Action Block
Write-Host "Destiny 2 Solo mode activated. Press any key to deactivate solo mode."
Read-Host
@MarcDufresne
MarcDufresne / post.bb
Last active February 20, 2018 19:03
[ANN][M0RK] m0rkcoin - Open-Source and Quality focus - NO PREMINE/NO ICO
[b]About m0rkcoin[/b]
m0rkcoin is a fork of ByteCoin and has a strong focus on privacy and anonymity, with features like:
[list]
[li]Untraceable payments[/li]
[li]Unlinkable transactions[/li]
[li]Double-spending proof[/li]
[/list]
m0rkcoin focuses on open-source, community, quality and ease of use. We will release all software we create as open-source with permissive license, pull requests, suggestions and feedback is welcome. We aim to create quality apps built on top of modern technology stacks.
@MarcDufresne
MarcDufresne / Instructions.md
Created January 12, 2018 23:08
m0rkcoind seed node setup

DigitalOcean Ubuntu

Requirements

In /root/:

apt-get update && apt-get install -y supervisor
wget https://api.montreal.ormuco.com:6780/swift/v1/m0rkcoin-v2/m0rkcoind
chmod +x m0rkcoind

Keybase proof

I hereby claim:

  • I am marcdufresne on github.
  • I am madx23 (https://keybase.io/madx23) on keybase.
  • I have a public key whose fingerprint is CE5C EC33 05B3 764E 71EF 0D8A 7FD1 3DFD 4B20 B057

To claim this, I am signing this object:

@MarcDufresne
MarcDufresne / transmeta.py
Created May 14, 2015 18:38
Kind of TransMeta Mongo/Flask
def get_fieldname(field, lang):
return "{}_{}".format(field, lang)
def safe_get_value(field):
def get_value(self):
field_name = lambda x: get_fieldname(field, x)