Skip to content

Instantly share code, notes, and snippets.

View foxmask's full-sized avatar
🇰🇷
Focusing

FoxMaSk foxmask

🇰🇷
Focusing
View GitHub Profile
@foxmask
foxmask / foobar.js
Created December 13, 2016 08:59
foobar.js
timer = $.timer(timeout, function() {
var request = $.ajax({
url: Urls.log_deploy(envId),
type: 'get',
dataType: 'html',
success: showResponse,
});
});
@foxmask
foxmask / deco.py
Created December 2, 2016 08:08 — forked from oinopion/deco.py
Use contextmanager to create a decorator
# Read docs here: https://docs.python.org/3/library/contextlib.html
>>> from contextlib import contextmanager
>>>
>>>
>>> @contextmanager
... def deco_and_cm():
... print('Hello')
... yield
... print('Goodbye')
...
#!/bin/bash
source $(dirname $0)/init.cfg
echo "Starting Gunicorn for $NAME"
exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
--log-level=$LOG_LEVEL \
import requests
import json
url = 'http://127.0.0.1:8000/th/api/taiga/webhook/123'
headers = {
"X-TAIGA-WEBHOOK-SIGNATURE": '5ff287f1565a40de55fbf1809a3781574e828f9c',
"X-Hub-Signature": "sha1={}".format('5ff287f1565a40de55fbf1809a3781574e828f9c'),
"Content-Type": "application/json"
}
@foxmask
foxmask / gist:84dfe256bb4d8b45011c159816ea85d8
Created November 21, 2016 21:25
docker with cookiecutter-django
$ docker-machine create --driver virtualbox dev
Running pre-create checks...
Creating machine...
(dev) Copying /home/foxmask/.docker/machine/cache/boot2docker.iso to /home/foxmask/.docker/machine/machines/dev/boot2docker.iso...
(dev) Creating VirtualBox VM...
(dev) Creating SSH key...
(dev) Starting the VM...
(dev) Check network to re-create if needed...
(dev) Waiting for an IP...
Waiting for machine to be running, this may take a few minutes...
@foxmask
foxmask / createapp.php
Created November 8, 2016 14:10
creation d'une appli jelix avec php7 et composer
php vendor/bin/createapp.php toto
PHP Warning: require(/home/foxmask/tmp/jelix-1.7.0pre-dev/vendor/jelix/jelix/bin/../vendor/autoload.php): failed to open stream: No such file or directory in /home/foxmask/tmp/jelix-1.7.0pre-dev/vendor/jelix/jelix/bin/createapp.php on line 9
PHP Fatal error: require(): Failed opening required '/home/foxmask/tmp/jelix-1.7.0pre-dev/vendor/jelix/jelix/bin/../vendor/autoload.php' (include_path='.:/usr/share/php') in /home/foxmask/tmp/jelix-1.7.0pre-dev/vendor/jelix/jelix/bin/createapp.php on line 9
@foxmask
foxmask / keybase.md
Created November 5, 2016 15:03
keybase.md

Keybase proof

I hereby claim:

  • I am foxmask on github.
  • I am foxmask (https://keybase.io/foxmask) on keybase.
  • I have a public key ASD1y1nw5XTkjSYI8XZ5CNK9DjQxKTDqL-vgQDK5gyDE-go

To claim this, I am signing this object:

@foxmask
foxmask / gunicorn_start
Created November 2, 2016 14:21
start gunicorn with initializing env var
$ cat ../bin/gunicorn_start
#!/bin/bash
source $(dirname $0)/init.cfg
echo "Starting Gunicorn for $NAME"
exec ../bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
--name $NAME \
--workers $NUM_WORKERS \
--user=$USER --group=$GROUP \
@foxmask
foxmask / snapcraft.yaml
Created October 29, 2016 12:27
a snapcraft that just install trigger-happy
name: trigger-happy
version: master
summary: An opensource clone of IFTTT.com, a bridge between your internet services
description: Trigger Happy is a system for building triggers to automate tasks
from your online services like Tiwtter, Evernote, Wallabag, etc
confinement: strict
parts:
trigger-happy-source:
plugin: python
@foxmask
foxmask / test.py
Created October 25, 2016 09:53
mocker l'appel à __init__ d'une classe
with patch('instapush.Instapush') as mock_save_data:
with patch('instapush.App') as mock_save_data2:
se = ServiceInstapush(self.token)
se.save_data(self.trigger_id, **self.data)
mock_save_data2.assert_called_once_with(user_token=self.token)
mock_save_data.assert_called_once_with(appid='app_id',
secret='secret')