Skip to content

Instantly share code, notes, and snippets.

View vovanbo's full-sized avatar
💭
I am

Vladimir Bolshakov vovanbo

💭
I am
View GitHub Profile
@mkoistinen
mkoistinen / admin.py
Last active August 29, 2015 13:58
Effectively adds a "ForeignKey" to a 3rd-party application's model (Post in this example) without monkey-patching the code. This is accomplished by adding a ManyToMany field instead on the other side of the desired relationship on the Item model (in this example), then, removing it from Item's admin and adding a ModelChoice field and Select widg…
# -*- coding: utf-8 -*-
# Django 1.6
from django.contrib import admin
from django.forms import ModelChoiceField
from django.forms.models import ModelForm
from blog.models import Post
from .models import Item
@adrianorsouza
adrianorsouza / mkselfssl.sh
Last active September 1, 2023 10:34
Script to create a new self-signed SSL Certificate for Nginx
#!/bin/bash
# @author Adriano Rosa (http://adrianorosa.com)
# @date: 2014-05-13 09:43
#
# Bash Script to create a new self-signed SSL Certificate
# At the end of creating a new Certificate this script will output a few lines
# to be copied and placed into NGINX site conf
#
# USAGE: this command will ask for the certificate name and number in days it will expire
@addyosmani
addyosmani / LICENSE.txt
Last active April 8, 2024 20:15 — forked from 140bytes/LICENSE.txt
Offline Text Editor in < 140 bytes (115 bytes). Powered by localStorage & contentEditable
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Copyright (C) 2014 ADDY OSMANI <addyosmani.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
@vlasovskikh
vlasovskikh / tweetread.py
Created June 1, 2014 23:26
Actor-based CLI Twitter client example for using asyncio
# Copyright (c) 2014 Andrey Vlasovskikh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active August 27, 2025 16:19
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@anentropic
anentropic / url_utils.py
Created July 29, 2014 10:24
reload Django urlconf
def reload_urlconf(urlconf=None, urls_attr='urlpatterns'):
if urlconf is None:
urlconf = settings.ROOT_URLCONF
if urlconf in sys.modules:
reload(sys.modules[urlconf])
reloaded = import_module(urlconf)
reloaded_urls = getattr(reloaded, urls_attr)
set_urlconf(tuple(reloaded_urls))

Аддмитоц, вер 3.0

Так сложилось, что времени на блог в чистом виде у меня сейчас нет. А ссылки, между тем, все приходят и приходят. А я их, разумеется, все букмаркаю и букмаркаю. Я много думал, что с этими ссылками делать. Вот одна из моих гипотез.

Сервис по обсуждению ссылок.

Дада, те кто был на reddit знают - это примерно именно оно, с некоторыми уточнениями. У меня есть интересные ссылки, в среднем на английском языке. Особой пользы в них нет, однако можно было бы предложить живым людям обсуждать эти ссылки, высказывать свои суждения и вообще. Я это вижу так:

  • Поток новостей. Тут показываются последние 10 новостей, которые я вбросил. Есть возможность оставить каменты к каждоый ссылке или проголосовать за понравившиеся чужие каменты. По умолчанию каменты скрыты за кликом, показывается только лучший по голосам камент (если он есть). Наверняка можно задействовать любой из существующих сервисов каментариев, если у него есть нормальный API.
  • Архив новостей. Тут хранятся старые ссылки и каменты к ни
@goldmann
goldmann / .zshrc
Last active June 24, 2019 06:18
Docker aliases / helper function
alias dip="docker inspect -f '{{ .NetworkSettings.IPAddress }}'"
dssh() {
PID=$(docker inspect --format {{.State.Pid}} $1)
sudo /usr/bin/nsenter --target $PID --mount --uts --ipc --net --pid env -i - $(sudo cat /proc/$PID/environ | xargs -0) bash
}
drmiall() {
docker rmi `docker images -q -f dangling=true`
}
@shymonk
shymonk / customize-save-in-django-admin-inline-form.org
Last active November 14, 2024 11:30
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):
@kristianmandrup
kristianmandrup / Converting libraries to Ember CLI addons.md
Last active March 12, 2025 04:26
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.