Skip to content

Instantly share code, notes, and snippets.

@pipoupiwam
pipoupiwam / git_remember_password.md
Created August 23, 2017 16:09 — forked from ankurk91/git_remember_password.md
Git credential cache, why type password again and again

Git tip: Tired of entering password again and again ?

Run this command to remember your password:

git config --global credential.helper 'cache --timeout 28800'

Above command will tell git to cache your password for 8 hours.

import yaml
from rest_framework.compat import coreapi, urlparse
from rest_framework.schemas import SchemaGenerator
from rest_framework_swagger import renderers
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework import exceptions
from rest_framework.permissions import AllowAny
@pipoupiwam
pipoupiwam / SimpleFilteringListView.py
Created February 7, 2017 14:10 — forked from teserak/SimpleFilteringListView.py
Django generic list view with simple filtering
from django.views.generic import ListView
class SimpleFilteringListView(ListView):
"""
List view with extra filtering and grouping in context data.
``filters`` dict is created as follows: {'context_variable_name', 'filtering_object_method_name'}
It calls filtering method on each object in object_list and if it returns True - this object is added
to proper context variable.
@pipoupiwam
pipoupiwam / git_python_current_branch.py
Created July 5, 2016 13:54 — forked from igniteflow/git_python_current_branch.py
GitPython get current active branch
"""
Gets the name of the active Git branch as a string.
Depends on GitPython
pip install GitPython
"""
from git import Repo
repo = Repo('/path/to/your/repo')
branch = repo.active_branch
@pipoupiwam
pipoupiwam / gist:f295397ba1ed5490bc8c
Created February 11, 2016 13:49
Kivy 1.9.1 VirtualEnv install : CRASH
########### PYTHON ENV ###########
$ python --version
Python 2.7.9
$ pip freeze
argh==0.26.1
boto==2.39.0
Cython==0.23.4
###########################################################################
################# Cannot reproduce with kivy 1.9.O windows portable install #
###########################################################################
C:\Users\micha\Kivy-1.9.0>python --version
botstrapping Kivy @ C:\Users\micha\Kivy-1.9.0\ with Python C:\Users\micha\Kivy-1.9.0\Python27
done bootstraping kivy...have fun!\n
running "python.exe --version" \n
Python 2.7.9
@pipoupiwam
pipoupiwam / read_VH400.ino
Created October 17, 2015 10:38 — forked from lx-88/read_VH400.ino
Arduino function to read a Vegetronix VH400 Soil Moisture Sensor. See http://www.vegetronix.com/Products/VH400/
// MIT License (MIT)
//
// Copyright (c) 2015. Michael Ewald, GeomaticsResearch LLC.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@pipoupiwam
pipoupiwam / sendkeys.py
Created October 13, 2015 18:52 — forked from upsuper/sendkeys.py
Send keys to clipboard or input directly (now only for Mac OS X and partly Linux)
# - * - coding: UTF-8 - * -
import subprocess
def macosx_set_clipboard(text):
p = subprocess.Popen('pbcopy', stdin=subprocess.PIPE)
p.communicate(text)
def macosx_send_keys(text):
text = text.replace('\\', '\\\\').replace('"', '\\"')
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import StringProperty
kv = '''
BoxLayout:
orientation: 'vertical'
BoxLayout:
size_hint_y: None
*.pyc