Skip to content

Instantly share code, notes, and snippets.

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");
@AlexECX
AlexECX / gist:0b04bc581a961547bb0c0f3092fd961a
Last active September 2, 2024 05:54
What I use to extract/unzip from Japanese shift-jis encoded zip files (prevent garbled filenames)
### Website converter
if the zip IS NOT PASSWORD PROTECTED, can use https://ianharmon.github.io/mojibake-fixer/
### Bandizip windows tool
Can either be downloaded from https://www.bandisoft.com/bandizip/dl/ or the windows store
During installation (or using the settings tab after install), use the same settings as in the screenshots from the top comment below.
### Linux | Windows WSL
Install `unzip` if not already on the system, them use `unzip -O shift-jis the-name-of-your-zipfile.zip`
@AlexECX
AlexECX / migration.py
Last active May 20, 2020 13:47
Example django RunPython function
from django.db import transaction
def revert(apps, schema_editor):
TargetModel = apps.get_model('appname', 'singlelinemodelname')
// Optionnal if using history models
HistoricalTargetModel = apps.get_model('appname', 'historicalsinglelinemodelname')
db_alias = schema_editor.connection.alias
with transaction.atomic(using=db_alias):
TargetModel.objects.using(db_alias) \
@AlexECX
AlexECX / server.py
Created May 13, 2020 15:03
A python server with ES6 JS modules compatible MIME types
import argparse
from http.server import SimpleHTTPRequestHandler, socketserver
def run(host, port):
Handler = SimpleHTTPRequestHandler
Handler.extensions_map.update({
'.js': 'application/javascript',
'.mjs': 'application/javascript',
@AlexECX
AlexECX / README-Template.md
Created July 15, 2019 23:11 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

from boost_transcrypt import __def_method__, getattr
from utils import TimeIt
class AnonWithLiteralTest:
def __init__(self):
__pragma__('js', '{}', """//Using an anonymous function with litteral""")
self.subject = self.subject_maker()
@AlexECX
AlexECX / cbv_multiple_forms.html
Created August 21, 2018 05:17 — forked from badri/cbv_multiple_forms.html
Django multiple forms code with sample usage
{% extends "base.html" %}
{% block content %}
<form method="post">{% csrf_token %}
{{ forms.subscription }}
<input type="submit" value="Subscribe">
</form>
<form method="post">{% csrf_token %}
{{ forms.contact }}
<input type="submit" value="Send">