Skip to content

Instantly share code, notes, and snippets.

Wojtek T mandhor

Block or report user

Report or block mandhor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View reset-opcache.php
<?php
/*
Copyright 2013 Stuart Carnie and other contributors
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
@mandhor
mandhor / ebsnvme-id
Created Oct 24, 2018 — forked from lbernail/ebsnvme-id
ebsnvme-id script
View ebsnvme-id
#!/usr/bin/env python2.7
# Copyright (C) 2017 Amazon.com, Inc. or its affiliates.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
View lockrun.c
/*
* $Id: //websites/unixwiz/unixwiz.net/webroot/tools/lockrun.c#8 $
*
* written by : Stephen J. Friedl
* Software Consultant
* Southern California USA
* steve@unixwiz.net
* http://www.unixwiz.net/tools/
*
* ===================================================================
@mandhor
mandhor / redis-migrate.sh
Created Mar 22, 2017 — forked from nicStuff/redis-migrate.sh
Comfort tool for migrating redis keys among instances. Supports KEYS syntax matching, authentication and TTL
View redis-migrate.sh
#!/bin/bash
######
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
# TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
######
@mandhor
mandhor / noip2
Created Apr 18, 2015
noip2 init.d
View noip2
#! /bin/sh
# /etc/init.d/noip2
### BEGIN INIT INFO
# Provides: noip2
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
@mandhor
mandhor / swipeRefreshLayoutRecyclerView.java
Created Apr 8, 2015
SwipeRefreshLayout RecyclerView bug workaround (SwipeRefreshLayout catches scroll up too early - not on top of the list - making it impossible to scroll up recyclerview)
View swipeRefreshLayoutRecyclerView.java
//we have to keep current scroll value somewhere in our fragment
private int overallYScroll = 0;
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
overallYScroll = overallYScroll + dy;
@mandhor
mandhor / gist:e89d2547eaad7b9ab82b
Created Apr 6, 2015
Convert DP to PX ( android dip dp pixels px )
View gist:e89d2547eaad7b9ab82b
int dp = 123;
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getResources().getDisplayMetrics());
@mandhor
mandhor / gist:92ce23904437d83e673d
Created Apr 6, 2015
[ SOLUTION ] SwipeRefreshLayout spinner not showing when .setRefreshing(true) called right after creating Fragment. ( android bug solution swiperefreshlayout pull to refresh not showing )
View gist:92ce23904437d83e673d
TypedValue typed_value = new TypedValue();
getActivity().getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, typed_value, true);
mSwipeRefreshLayout.setProgressViewOffset(false, 0, getResources().getDimensionPixelSize(typed_value.resourceId));
@mandhor
mandhor / burgerArrowTransition.java
Created Apr 6, 2015
Android - method for animating ActionBarDrawerToggle between hamburger (drawer) and back arrow (home)
View burgerArrowTransition.java
android.support.v7.app.ActionBarDrawerToggle mDrawerToggle;
android.support.v4.widget.DrawerLayout mDrawerLayout;
public void burgerArrowTransition(final boolean burgerToArrow) {
float start, end;
mDrawerToggle.setDrawerIndicatorEnabled(true);
if(burgerToArrow) {
start = 0.0f;
@mandhor
mandhor / gist:0443ddf151ab2bdbdffc
Last active May 29, 2019
[ SOLUTION ] JSON REST API returning List of different objects - source of LinkedTreeMap problem when deserializing data
View gist:0443ddf151ab2bdbdffc
// Source of problem
// JSON output from API
[
{
"id": 1,
"created_at": "01-06-2014",
"type": "message",
"text": "Hi there!",
"from": {
You can’t perform that action at this time.