Skip to content

Instantly share code, notes, and snippets.

View tim-hub's full-sized avatar
:octocat:
Patience is Love

Tim tim-hub

:octocat:
Patience is Love
View GitHub Profile
@Richard-Mathie
Richard-Mathie / Redis Cluster Flask Cache.md
Last active June 12, 2017 14:10
Redis Cluster plugin for Flask Cache

Flask Cache Redis Cluster Backend

This impliments a redis cluster backend for Flask-Cache as the standard redis cache cannot handle a redis cluster.

Usage

class Config(object):
@codeswimmer
codeswimmer / Android: MotionEvent.ACTION converted to String
Created April 3, 2011 20:34
Android: covert the given MotionEvent.getAction() result into a String.
public static String eventActionToString(int eventAction) {
switch (eventAction) {
case MotionEvent.ACTION_CANCEL: return "Cancel";
case MotionEvent.ACTION_DOWN: return "Down";
case MotionEvent.ACTION_MOVE: return "Move";
case MotionEvent.ACTION_OUTSIDE: return "Outside";
case MotionEvent.ACTION_UP: return "Up";
case MotionEvent.ACTION_POINTER_DOWN: return "Pointer Down";
case MotionEvent.ACTION_POINTER_UP: return "Pointer Up";
}
function get_browser() {
var ua = navigator.userAgent,
tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return {
name: 'IE',
version: (tem[1] || '')
};
}
# initialise new project package environment
npm init
PIPENV_VENV_IN_PROJECT=1 pipenv install

# install major version of package P (and dependencies)
npm i P@1
pipenv install --selective-upgrade "P<2"
@LayZeeDK
LayZeeDK / generate-project.js
Last active April 28, 2022 08:04
Angular CLI workspace tool: Generate project.
const childProcess = require('child_process');
const fs = require('fs');
const yargs = require('yargs');
function addScopeToLibraryProjectName({ name, scope }) {
runCommand('npx json -I -f angular.json '
+ `-e "this.projects['${scope}-${name}'] = this.projects['${name}']"`);
runCommand(`npx json -I -f angular.json -e "delete this.projects['${name}']"`);
}
function get_browser() {
var ua = navigator.userAgent,
tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return {
name: 'IE',
version: (tem[1] || '')
};
}
@victor-torres
victor-torres / uninstall_shell_integration.sh
Created March 1, 2016 12:51
Uninstalling shell integration from iTerm 2
#!/bin/bash
function die() {
echo "${1}"
exit 1
}
which printf > /dev/null 2>&1 || die "Shell integration requires the printf binary to be in your path."
which sed > /dev/null 2>&1 || die "Shell integration requires the sed binary to be in your path."
@tonious
tonious / avl.c
Created November 18, 2011 21:13
A quick AVL tree implementation in c.
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <assert.h>
struct avl_node_s {
@DerFichtl
DerFichtl / clamav-macosx.md
Last active January 2, 2024 22:34
clamav on mac osx - install and configure the virus scanner on mac osx
layout title published tags
post
clamav - install and configure on mac osx
true
blog
clamav

Install Clamav

Install clamav via homebrew

@jult
jult / .stglobalignore
Last active March 5, 2024 07:19
syncthing ignore file(s) .stglobalignore and .stignore
// .stglobalignore
// These prevent SyncThing from trying to sync data that's locked, constantly changing, going to be thrown out, unimportant, etc.
// Lots of conflicts/issues disappeared using these ignores, but do check to prevent major disappointment!
// *.log and *cache* are in there, just so you know.. but firefox' startupCache and offlineCache will be synced.
// Ignores are case sensitive.
// Put both .stignore and this .stglobalignore in the root of your sync folder(s) (where .stfolder resides)
$RECYCLE.BIN
$WINDOWS.~BT