Skip to content

Instantly share code, notes, and snippets.

@mkawserm
mkawserm / StatusBarUtils.java
Created July 22, 2016 18:08 — forked from samigehi/StatusBarUtils.java
add ImageView to Status Bar, Transparrent Status Bar
// add background image to Status Bar android
private void setStatusBar(Activity activity, int imageRes) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
from django.contrib.sessions.backends.base import SessionBase, CreateError
from django.conf import settings
from django.utils.encoding import force_unicode
import redis
class SessionStore(SessionBase):
""" Redis store for sessions"""
def __init__(self, session_key=None):
self.redis = redis.Redis(
#! /usr/bin/env python
import fileinput
import argparse
from operator import itemgetter
parser = argparse.ArgumentParser()
parser.add_argument('--target-mb', action = 'store', dest = 'target_mb', default = 61000, type = int)
parser.add_argument('vmtouch_output_file', action = 'store', nargs = '+')
args = parser.parse_args()
This snippet tested on Yosemite 10.10.1
1. Define your python3 directory (for example, "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/")
2. Download "http://download.qt-project.org/official_releases/qt/5.3/5.3.2/qt-opensource-mac-x64-clang-5.3.2.dmg" or any other new version of qt for mac and install it.
3. Download SIP sources here: http://www.riverbankcomputing.com/software/sip/download
4. Download PyQt5-gpl sources here: http://www.riverbankcomputing.com/software/pyqt/download5
5. Go to your downloads by terminal (for example, "cd ~/Downloads")
6. tar xvf PyQt-gpl-5.3.2.tar.gz
7. tar xvf sip-4.16.4.tar.gz
8. cd sip-4.16.4/
function getJSON(aUrl,sheetname) {
//var sheetname = "test";
//var aUrl = "http://pipes.yahoo.com/pipes/pipe.run?_id=286bbb1d8d30f65b54173b3b752fa4d9&_render=json";
var response = UrlFetchApp.fetch(aUrl); // get feed
var dataAll = JSON.parse(response.getContentText()); //
var data = dataAll.value.items;
for (i in data){
data[i].pubDate = new Date(data[i].pubDate);
data[i].start = data[i].pubDate;
}

Guide to install PyQt5 on Mac OS X with python 3.4 virtualenv

Description

A simple guide to install PyQt5 on Mac OS X 10.9 (Maverick) and use python 3.4 on a virtualenv.

Requirements

  • xcode 5.1.1
  • python 3.4.0
  • Qt libraries 5.2.1
/*
All code apart from getPlusones()
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
@mkawserm
mkawserm / A02.F90
Last active August 29, 2015 14:01
Solve Tridiagonal Linear Systems using CROUT Factorization using FORTRAN 90/95 [LU FACTORIZATION FOR TRIDIAGONAL SYSTEM]
!Name : LU FACTORIZATION FOR TRIDIAGONAL SYSTEM
!Author : KAWSER
!Blog : http://blog.kawser.org
!Created : 22/05/2014 7:48 AM
!
!Short URL : http://goo.gl/Uu9dNV
!
!Purpose : We'll solve the system using CROUT Factorization
! for Tridiagonal Linear Systems
!
@mkawserm
mkawserm / Wi-fi Configuration For Raspberry Pi
Created May 16, 2014 03:31
My Raspberry Pi interfaces file contents With wi-fi configuration
auto lo
iface lo inet loopback
#allow-hotplug eth0
#auto eth0
iface eth0 inet static
address 192.168.43.2
network 192.168.43.0