Skip to content

Instantly share code, notes, and snippets.

@bjoern-r
bjoern-r / Huawei_E3372_openwrt.md
Last active December 7, 2024 15:46
How to use a Huawei E3372 on OpenWRT

HOWTO use a Huawei E3372 on OpenWRT

This modem is also sold as a MegaFon M150-2 USB dongle

Needed Software

Install the needed packages via opkg tool

opkg update
import django_filters
class CommaSeparatedValueFilter(django_filters.CharFilter):
"""Accept comma separated string as value and convert it to list.
It's useful for __in lookups.
"""
def filter(self, qs, value):
@Karmak23
Karmak23 / drf-no-none.py
Last active March 10, 2023 04:47
django-rest-framework Model Serializer base class to exclude None/null values from output.
class WithoutNoneFieldsSerializer(serializers.ModelSerializer):
""" Exclude model fields which are ``None``.
This eventually includes foreign keys and other special fields.
Source: https://gist.github.com/Karmak23/5a40beb1e18da7a61cfc
"""
def to_native(self, obj):
@Karmak23
Karmak23 / drf_logger.py
Last active November 29, 2020 00:53
Django Rest Framework logger mixin
class DRFLoggerMixin(object):
"""
Allows us to log any incoming request and to know what's in it.
Usage:
class MyOwnViewSet(DRFLoggerMixin,
mixins.ListModelMixin,
viewsets.GenericViewSet):
@ricardo-rossi
ricardo-rossi / ElasticSearch.sh
Last active February 25, 2025 22:09
Installing ElasticSearch on Ubuntu 14.04
#!/bin/bash
### USAGE
###
### ./ElasticSearch.sh 1.7 will install Elasticsearch 1.7
### ./ElasticSearch.sh will fail because no version was specified (exit code 1)
###
### CLI options Contributed by @janpieper
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch
"""Here's how you implement Foo(pkid) with postgres.orm 2.1.x.
Discovered at PyTennesse with @wlphoenix @PederSchacht et al.
"""
class Foo(Model):
typname = 'foo'
def __new__(cls, pkid_or_record):
@aaugustin
aaugustin / HOWTO.md
Last active December 3, 2019 20:18
Connecting a Django application to a Microsoft SQL Server database from Debian GNU/Linux
  1. Install and register the FreeTDS driver for unixODBC.

     apt-get install tdsodbc
     odbcinst -i -d -f /usr/share/tdsodbc/odbcinst.ini
    
  2. (Optional) Test the DSN-less connection with pyodbc.

     apt-get install python-pyodbc
    

>>> import pyodbc

@namuol
namuol / INSTALL.md
Last active December 11, 2024 12:21
rage-quit support for bash

rage-quit support for bash

HOW TO INSTALL

Put flip somewhere in your $PATH and chmod a+x it.

Copy fuck into ~/.bashrc.

@mdpatrick
mdpatrick / postgresql_9.1_to_9.3_on_ubuntu_12.04
Last active June 21, 2018 10:35
Upgrade PostgreSQL from 9.1 to 9.3 on Ubuntu 12.04
# Probably excessive, but it makes these instructions simpler
sudo -i
# Add postgresql repo and update apt listing
echo "deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main" > /etc/apt/sources.list.d/pgdg.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
# For some reason this is necessary with PostgreSQL on Ubuntu 12.04
update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz
@nawroth
nawroth / doctests.adoc
Last active August 29, 2015 13:56
location of doc tests in neo4j

Neo4j Documentation

The Neo4j Manual is versioned and released together with the product. An overview of parts of the documentation workflow is found in the manual itself, in the chapter Writing Neo4j Documentation. We use several different approaches to verify our documentation by tests running in CI when the product is built. Testing as much as possible of examples especially makes sense, as we also provide ways to interactively play with Neo4j, see for example Create nodes and relationships.

The documentation toolchain also makes sure that all cross references have valid targets.

The core tools for our documentation are AsciiDoc and DocBook.