Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
__all__ = ( | |
####### Class Objects | |
#CoGetClassObject - Normal, not wrapped | |
'CoDllGetClassObject', #Get ClassObject from a DLL file | |
####### ClassFactory::CreateInstance Wrappers | |
'CoCreateInstanceFromFactory', #Create an object via IClassFactory::CreateInstance | |
'CoCreateInstanceFromFactoryLicenced', #Create a licenced object via IClassFactory2::CreateInstanceLic |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
""" | |
Test (data) migrations in Django. | |
This uses py.test/pytest-django (the `transactional_db` fixture comes from there), | |
but could be easily adopted for Django's testrunner: | |
from django.test.testcases import TransactionTestCase | |
class FooTestcase(TransactionTestCase): | |
def test_with_django(self): |
@contextlib.contextmanager | |
def multiple_targets(mock_patches): | |
""" | |
`mock_patches` is a list (or iterable) of mock.patch objects | |
Example usage: | |
with mock.patch.multiple_targets([ | |
mock.patch('os.path.exists', side_effect=mock_path_exists), | |
mock.patch('subprocess.Popen'), |
# Add field | |
echo '{"hello": "world"}' | jq --arg foo bar '. + {foo: $foo}' | |
# { | |
# "hello": "world", | |
# "foo": "bar" | |
# } | |
# Override field value | |
echo '{"hello": "world"}' | jq --arg foo bar '. + {hello: $foo}' | |
{ |
Slack doesn't provide an easy way to extract custom emoji from a team. (Especially teams with thousands of custom emoji) This Gist walks you through a relatively simple approach to get your emoji out.
If you're an admin of your own team, you can get the list of emoji directly using this API: https://api.slack.com/methods/emoji.list. Once you have it, skip to Step 3
HOWEVER! This gist is intended for people who don't have admin access, nor access tokens for using that list.
Follow along...
#!/usr/bin/env python | |
from __future__ import print_function | |
import json | |
import logging | |
from urllib2 import Request, urlopen, URLError, HTTPError | |
from base64 import b64decode |
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |