This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.conf import settings | |
User = settings.AUTH_USER_MODEL | |
class BlogQuerySet(models.QuerySet): | |
def published(self): | |
return self.filter(published=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('[ GAME: Guess number ]') | |
const readline = require('readline').createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}) | |
let count = 1 | |
let genNum = Math.round(Math.random() * 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
README: | |
Simply change: | |
1. YOUR_OBJECT_NAME to your object model name | |
2. ?page= to your GET parameter | |
3. Add any layout you need (Bootstrap etc.) | |
--> | |
<ul> | |
{% if YOUR_OBJECT_NAME.has_previous %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect to HTTPS | |
RewriteCond %{HTTPS} off | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollToTop() { | |
var pxFromTop = 800; | |
$('#footer').append('<div id="goTop">Scroll To Top</div>'); | |
$('#goTop').hide(); | |
$(window).scroll(function () { | |
if ($(this).scrollTop() > pxFromTop) { | |
$('#goTop').fadeIn(); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Windows Registry Editor Version 5.00 | |
; Created by: Shawn Brink | |
; Created on: May 6th 2015 | |
; Updated on: April 16th 2017 | |
; Tutorial: https://www.tenforums.com/tutorials/5918-turn-off-windows-defender-windows-10-a.html | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender] | |
"DisableAntiSpyware"=dword:00000001 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Full list of commands https://ultradefrag.net/handbook/v8/standard/Console.html | |
@echo off | |
echo ################### UltraDefrag ################### | |
:: Perform quick optimization for all fixed drives | |
udefrag -q --all-fixed | |
:: Defragment all fixed drives | |
udefrag --all-fixed | |
:: pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
# Mutagen docs https://mutagen.readthedocs.io/ | |
from mutagen.mp3 import MP3 | |
# Settings | |
PATH_TO_MP3_DIR = 'D:\\mp3\\' | |
RESULTS_FILENAME = 'mp3_with_errors.txt' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd ~/Dropbox/flask_project/ | |
# Activate virtualenv | |
source venv/bin/activate | |
cd ./app | |
export FLASK_APP=app.py && export FLASK_ENV=development && flask run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SettingsAdmin(admin.ModelAdmin): | |
def has_add_permission(self, request): | |
# if there's already an entry, do not allow adding | |
count = Settings.objects.all().count() | |
if count == 0: | |
return True | |
return False | |
admin.site.register(Settings, SettingsAdmin) |
NewerOlder