Skip to content

Instantly share code, notes, and snippets.

View i-salameh95's full-sized avatar

Israa Salameh i-salameh95

View GitHub Profile
@jstnlvns
jstnlvns / git: gitignore.md
Created November 16, 2018 19:42
a gitignore cheatsheet

Git sees every file in your working copy as one of three things:

  1. tracked - a file which has been previously staged or committed;
  2. untracked - a file which has not been staged or committed; or
  3. ignored - a file which Git has been explicitly told to ignore.

Ignored files are usually build artifacts and machine generated files that can be derived from your repository source or should otherwise not be committed. Some common examples are:

  • dependency caches, such as the contents of /node_modules or /packages
  • compiled code, such as .o, .pyc, and .class files
@jacobwegner
jacobwegner / data-recovery-README.md
Last active January 30, 2024 06:29
Recovering data deleted via the Django admin

I was looking for a way to revert data deleted by mistake from the Django admin.

I reverse-engineered how Django's admin builds the list of objects displayed on the "Are you sure?" confirmation page.

Given a single obj or list of objs, the script included in this gist will:

  • Use the NestedObjects utility to determine the objects that would be deleted
  • Pass those objects to Django's JSON serializer
  • Write the objects to adeleted-objects fixture
@federicobond
federicobond / fix-makemessages.sh
Last active February 4, 2024 12:43
Fix errors / warnings when running `python manage.py makemessages` with `xlwt` installed.
#!/bin/bash
#
# This scripts solves the following error when running Django's makemessages with xlwt installed.
# It also gets rid of the warnings.
#
# CommandError: errors happened while running xgettext on UnicodeUtils.py
# xgettext: ./env/lib/python2.7/site-packages/xlwt/UnicodeUtils.py:1: Unknown encoding "windows-1252". Proceeding with ASCII instead.
# xgettext: Non-ASCII string at ./env/lib/python2.7/site-packages/xlwt/UnicodeUtils.py:37.
# Please specify the source encoding through --from-code or through a comment
#  as specified in http://www.python.org/peps/pep-0263.html.