Skip to content

Instantly share code, notes, and snippets.

int A = 8;
int B = 9;
int C = 10;
int D = 11;
int E = 12;
int F = 13;
int G = 6;
int H = 7;
int D1 = 2;
@Xowap
Xowap / pinger.sh
Created May 23, 2015 13:14
Get minimum ping time for different ping counts
#!/bin/bash
function quickping {
sudo ping -s 200 -i 0.1 -c $2 $1 | tail -n 1 | grep -oE '[\.0-9]+' | head -n 1
}
target=$1
max=$2
for i in `seq 1 $max`;
@Xowap
Xowap / gulp.py
Last active February 10, 2018 22:51
Gulp Assets
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
from __future__ import unicode_literals
import json
import codecs
class AssetsLister(object):
def __init__(self, live, manifest):
@Xowap
Xowap / example.html
Created June 27, 2015 10:39
Django QueryString patch template tag
<a href="?{% qspatch page=clients.paginator.num_pages %}"><span>{{ clients.paginator.num_pages }}</span></a>
#!/usr/bin/python
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
from __future__ import unicode_literals
from unittest import TestCase
try:
from dopy.manager import DoError, DoManager
#!/usr/bin/python
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
from __future__ import unicode_literals
try:
from deis import DeisClient
except ImportError:
DeisClient = None
@Xowap
Xowap / i18n.py
Created September 10, 2015 11:21
Helpers for translating hstore fields in Django
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
#
# gmc_api
# (c) 2015 ActivKonnect
from django.core.exceptions import ValidationError
from django.utils.six import string_types
from django.utils.translation import get_language
from django.conf import settings
@Xowap
Xowap / gulpfile.js
Created November 13, 2015 15:59
Gulpfile for Django (single app)
'use strict';
const DIST_DIR = 'gif/static';
const SRC_DIR = 'gif/static_src';
const MAPS_DIR = 'maps';
const JS_SRC = [
'node_modules/angular/angular.js',
'node_modules/angular-route/angular-route.js',
'node_modules/angular-touch/angular-touch.js',
@Xowap
Xowap / replacer.py
Last active January 25, 2016 18:39
Replace SSL certificates in all files and keep indentation
#!/usr/bin/env python3
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
#
# ssh_replacer
# (c) 2015 ActivKonnect
from sys import argv, exit, stderr
from re import compile
from os import walk, path
#!/usr/bin/env python3
# vim: fileencoding=utf-8 tw=100 expandtab ts=4 sw=4 :
import sys
import subprocess
from email.parser import Parser
from email.utils import parseaddr, formataddr
# ---