Skip to content

Instantly share code, notes, and snippets.

@lorne-luo
lorne-luo / python_console_for_pycharm.py
Last active March 17, 2020 10:03
django_extensions' shell_plus for Pycharm's python console
# open Pycharm settings->Build,Execution,Deployment->Console->Django Console
# 1.add env var: DJANGO_SETTINGS_MODULE -> settings.settings
# 2.copy below into Starting script
# open preferences->keymap->search `Python Console`->create new shortcut `cmd + 3`
from pprint import pprint
from django_extensions.management.shells import import_objects
from django.core.management.color import no_style
from datetime import datetime
@0xjac
0xjac / private_fork.md
Last active July 29, 2024 15:27
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active July 14, 2024 19:55
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@thomasst
thomasst / migrate-redis.py
Created May 14, 2015 18:26
Migrate Redis data on Amazon ElastiCache
"""
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@shymonk
shymonk / customize-save-in-django-admin-inline-form.org
Last active April 14, 2024 02:55
How to customize save in django admin inline form?

Customize Save In Django Admin Inline Form

Background

This is a common case in django ORM.

from django.db import models

class Author(models.Model):
#!/usr/bin/env python
# Quick and dirty demonstration of CVE-2014-0160 by
# Jared Stafford (jspenguin@jspenguin.org)
# Modified so that it finds cookies
import sys
import struct
import socket
import time
import select
@tripu
tripu / Useful-glyphs.md
Last active October 29, 2018 07:37
Useful glyphs
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active July 7, 2024 19:32
A badass list of frontend development resources I collected over time.
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active July 17, 2024 14:20
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: