Skip to content

Instantly share code, notes, and snippets.

@spoof
spoof / settings.py
Created September 23, 2010 13:50 — forked from blackrobot/settings.py
"""
Here's my sample Django settings for a project I recently did. Visit http://damonjablons.wordpress.com to see the explanation.
"""
import os
import socket
# Set DEBUG = True if on the production server
if socket.gethostname() == 'your.domain.com':
DEBUG = False
spoof@mac:~% brew install -vd mc
==> Build Environment
CC: /usr/bin/cc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CXX: /usr/bin/c++ => /usr/bin/c++-4.2
LD: /usr/bin/cc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2
CFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
CXXFLAGS: -O3 -march=core2 -msse4.1 -w -pipe
MAKEFLAGS: -j2
==> Downloading http://www.midnight-commander.org/downloads/mc-4.7.4.tar.bz2
File already downloaded and cached to /Users/spoof/Library/Caches/Homebrew
@spoof
spoof / gist:4690505
Last active December 12, 2015 01:19
spoof@spoofs-mac:tests% python test_filter.py
list comprehension 0.0898420810699
filter lambda 0.104062080383
filter None 2.14576721191e-06
--------------------
def list_comprehension(data):
return [x for x in data if x]
17 0 BUILD_LIST 0
3 LOAD_FAST 0 (data)
This file has been truncated, but you can view the full file.
nomn gent accs loct
--------------------------- --------------------------- --------------------------- ---------------------------
москва москвы москву москве
абрамцевое абрамцевого абрамцевое абрамцевом
алабино алабина алабино алабине
апрелевка апрелевки апрелевку апрелевке
архангельское архангельского архангельское архангельском
ашитковое ашиткового ашитковое ашитковом
байконур байконура байконур байконуре
@spoof
spoof / postgres_queries_and_commands.sql
Created April 14, 2016 11:41 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@spoof
spoof / BluetoothRestart
Created January 16, 2018 22:39 — forked from ajmaradiaga/BluetoothRestart
Force Bluetooth Restart on Mac
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist
@spoof
spoof / ViewTransformation.swift
Created March 2, 2018 17:34 — forked from ninjaprox/ViewTransformation.swift
Understanding UIView's tranform property
//: Playground - noun: a place where people can play
import UIKit
import XCPlayground
// MARK: - Helpers
extension UIView {
func addBorderWith(color: UIColor, width: CGFloat, alpha: CGFloat = 1) {
self.layer.borderColor = color.colorWithAlphaComponent(alpha).CGColor
@spoof
spoof / pep484transform.py
Created April 23, 2018 09:02 — forked from davidhalter/pep484transform.py
Jedi generates Pep 484 type annotations.
"""
Transforms a normal Python file to pep484 annotations using Jedi.
Usage:
pep484transform.py <file> [-d]
Options:
-d, --debug Show Jedi's debug output.
"""
from os.path import abspath
@spoof
spoof / my_test.py
Created May 18, 2018 10:58 — forked from seddonym/my_test.py
Django test class for asserting the connection of a receiver to a given signal
from django.test import TestCase
class ReceiverConnectionTestCase(TestCase):
"""TestCase that allows asserting that a given receiver is connected to a signal.
Important: this will work correctly providing you:
1. Do not import or patch anything in the module containing the receiver in any django.test.TestCase.
2. Do not import (except in the context of a method) the module containing the receiver in any test module.