TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
use serde::{Deserialize, Serialize}; | |
pub trait SerdeDeserializeObject { | |
fn new<'de>(data: &'de str) -> Self | |
where | |
Self: Deserialize<'de>, | |
{ | |
let serialized_data: Self = serde_json::from_str(&data).unwrap(); | |
serialized_data | |
} |
from rest_framework.filters import OrderingFilter | |
class CustomOrderFilter(OrderingFilter): | |
allowed_custom_filters = ['user_city', 'user_country'] | |
fields_related = { | |
'user_city': 'user__city__name', # ForeignKey Field lookup for ordering | |
'user_country': 'user__country__name' | |
} | |
def get_ordering(self, request, queryset, view): |
""" | |
This gist shows how to run asyncio loop in a separate thread. | |
It could be useful if you want to mix sync and async code together. | |
Python 3.7+ | |
""" | |
import asyncio | |
from datetime import datetime | |
from threading import Thread | |
from typing import Tuple, List, Iterable |
// we will use weak references with the Rc<T> (reference counting pointer) type | |
// weak references allow us to make references to a value that will -not- keep it alive | |
// this is perfect in the intsance of children, as we will soon see | |
use std::rc::{Rc,Weak}; | |
use std::cell::RefCell; | |
// this example builds upon the last by storing a vector of children as well as a parent | |
#[derive(Debug)] | |
struct Node { |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import Session | |
from myapp.models import BaseModel | |
import pytest | |
@pytest.fixture(scope='session') | |
def engine(): | |
return create_engine('postgresql://localhost/test_database) |
d-i debian-installer/locale string en_US | |
d-i keymap select de | |
d-i keyboard-configuration/xkb-keymap select de | |
d-i console-setup/ask_detect boolean false | |
d-i keyboard-configuration/layoutcode string de | |
d-i netcfg/choose_interface select auto | |
d-i netcfg/get_hostname string debianhost | |
d-i netcfg/get_domain string mydomain | |
d-i netcfg/wireless_wep string |
# How to run | |
# In the folder with these files | |
# sudo python -m SimpleHTTPServer 80 | |
# | |
# Update the ip at the bottom of this file to the output of | |
# hostname -I | |
# This is your ip | |
# | |
# Start debian cd | |
# Press esc on menu |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
# /etc/systemd/system/iperf.service | |
[Unit] | |
Description=iperf server | |
After=syslog.target network.target auditd.service | |
[Service] | |
ExecStart=/usr/bin/iperf -s | |
[Install] | |
WantedBy=multi-user.target |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import Session | |
from myapp.models import BaseModel | |
import pytest | |
@pytest.fixture(scope="session") | |
def engine(): | |
return create_engine("postgresql://localhost/test_database") |