This file contains 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
restore db without owner | |
pg_restore -U user -d db -1 db.sql -O --no-owner | |
psql -d db -f file.dump -U user -W -h host | |
sie db | |
SELECT | |
nspname || '.' || relname AS "relation", |
This file contains 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
for offset < count { | |
for i, _ := range []int{1, 2} { | |
new_offset := offset + (limit * i) | |
go doRequest(hostConn, sess, params, clientID, importLog, new_offset, limit, urls, &wg) | |
} | |
wg.Wait() | |
offset = offset + (limit * 2) | |
} |
This file contains 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 moviepy.editor import * | |
cad = u'98597661-10.jpg' | |
myclip = ImageClip(cad).fx(vfx.resize, newsize=[1280, 660]) | |
final = CompositeVideoClip([myclip], size=(1280, 720)) | |
final.set_duration(7).write_videofile("test.mp4", fps=30) |
This file contains 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 functools | |
from channels.handler import AsgiRequest | |
from rest_framework.exceptions import AuthenticationFailed | |
from rest_framework.settings import api_settings | |
authenticators = [auth() for auth in api_settings.DEFAULT_AUTHENTICATION_CLASSES] | |
This file contains 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
const InputBox = React.createClass({ | |
getInitialState: function() { | |
return {data: [], interval: undefined}; | |
}, | |
componentDidMount: function() { | |
const inverval = setInterval(this.update, 5000); | |
this.setState({inverval}); | |
}, | |
componentWillUnmount: function() { | |
clearInterval(this.state.inverval); |
This file contains 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 asyncio | |
from growler import App | |
from growler.middleware import (Logger, Static, Renderer, Timer) | |
loop = asyncio.get_event_loop() | |
# Construct our application with name GrowlerServer | |
app = App('GrowlerServer', loop=loop) |
This file contains 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
''' | |
Character width dictionary and convenience functions for column sizing | |
with xlwt when Arial 10 is the standard font. Widths were determined | |
experimentally using Excel 2000 on Windows XP. I have no idea how well | |
these will work on other setups. For example, I don't know if system | |
video settings will affect the results. I do know for sure that this | |
module won't be applicable to other fonts in general. | |
//John Yeung 2009-09-02 | |
''' |
This file contains 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 ConvertMixin(object): | |
def convert(self, obj): | |
options = obj._meta | |
for field in sorted(options.get_fields()): | |
if self.attr_exists(field.name) and field.name not in obj.get_list_remove(): | |
self.__setattr__(field.name,obj.__getattribute__(field.name)) | |
def attr_exists(self, name): | |
return hasattr(self, name) or hasattr(self,"%s_id" % name) |
This file contains 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 InstanceMixin(object): | |
def add_arguments(self): | |
return {'empresa':self.request.empresa} | |
def get_form_kwargs(self): | |
""" | |
Returns the keyword arguments for instanciating the form. | |
""" | |
kwargs = super(InstanceMixin, self).get_form_kwargs() |
This file contains 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 | |
from django.conf import settings | |
from django.shortcuts import render | |
from django.test.utils import override_settings | |
@override_settings(STATIC_URL="{}/".format(os.path.abspath(settings.STATIC_ROOT))) | |
def html_for_print(request, context_object_name, instance, template): | |
data = {context_object_name: instance} | |
return render(request, template, data) |
NewerOlder