Skip to content

Instantly share code, notes, and snippets.

View qnub's full-sized avatar
👁️‍🗨️

Vadim Lopatiuk qnub

👁️‍🗨️
View GitHub Profile
@qnub
qnub / fabfile.py
Created April 2, 2012 16:20
Fabric local commenter and uncommenter
# -*- coding: utf-8 -*-
"""
Easy change settings with uncomment right string ang comment wrong.
Iterate over files in ``env.settings_files``, comment lines with
wrong marker and uncomment with right marker.
Usage
=====
@qnub
qnub / django_project_apps_test_runner.py
Last active December 20, 2015 03:09
Run only PROJECT_APPS tests. INSTALLED_APPS += PROJECT_APPS
import logging
from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
TESTING_APPS = getattr(settings, 'PROJECT_APPS', getattr(settings, 'INSTALLED_APPS', []))
class ProjectAppsTestSuiteRunner(DjangoTestSuiteRunner):
'''
@qnub
qnub / btsync
Created August 31, 2013 11:01 — forked from mendelgusmao/btsync
#!/bin/sh
### BEGIN INIT INFO
# Provides: btsync
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Multi-user daemonized version of btsync.
@qnub
qnub / gitlab_up.sh
Last active August 29, 2015 14:16
GitLab Omnibus debian package update script
#!/bin/bash
# example: sudo ./gitlab_up.sh package_filenaname.deb
# get it here https://about.gitlab.com/downloads/ (copy link to package without filename, it must be set through command line)
URL="https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/"
if [ ! $1 ];
then
echo "Set downloadable .deb name!"
@qnub
qnub / database-reset.js
Last active January 27, 2016 01:46
Meteor Jasmine client integration tests database reset
if (process.env.IS_MIRROR) {
Meteor.methods({
'loadFixtures': function(){
console.log('Loading default fixtures');
// TODO: add your fixtures here
Accounts.createUser({
email: '[email protected]',
password: '123456'
});
console.log('Finished loading default fixtures');
@qnub
qnub / .eslintrc
Created August 5, 2015 06:13
.eslintrc
{
"parser": "babel-eslint",
"ecmaFeatures": {
"blockBindings": true,
"forOf": true,
"jsx": true,
"modules": true
},
"env": {
"browser": true,
@qnub
qnub / acme-challenge
Last active November 6, 2016 07:31
Script for auto renew Let's Encrypt serts
location /.well-known/acme-challenge/ {
root /var/run/acme/acme-challenge/;
}
@qnub
qnub / agnoster-exec-time-powerline.zsh-theme
Last active May 13, 2016 06:44
ZSH agnoster theme with exec time
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# Excluded VCS part — use varsion from Powerline
#
# In order for this theme to render correctly, you will need a
@qnub
qnub / README.md
Last active March 12, 2016 17:44
Nginx ACME SSL config

Let's Encrypt + ACME + Nginx

ACME tool example config for acme configured with WEBROOT in /var/run/acme/acme-challenge.

Caveats

If you once have created single cert for dev.example.com and example.com with:

sudo acmetool want dev.example.com example.com

@qnub
qnub / README.md
Created March 12, 2016 06:01
Angular hints

$http.config for Django

angular.module('MyApp').config(function($httpProvider) {
  $httpProvider.defaults.xsrfCookieName = 'csrftoken';
  $httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
  $httpProvider.defaults.headers
      .common['X-Requested-With'] = 'XMLHttpRequest';
  $httpProvider.defaults.headers
      .post['Content-Type'] = 'application/x-www-form-urlencoded';

});