Skip to content

Instantly share code, notes, and snippets.

View cafuego's full-sized avatar
😢

Peter Lieverdink cafuego

😢
View GitHub Profile
@cafuego
cafuego / build-tensorflow-from-source.md
Last active September 19, 2019 06:46 — forked from Brainiarc7/build-tensorflow-from-source.md
Build Tensorflow from source, for better performance

Building Tensorflow from source on Linux for maximum performance:

TensorFlow is now distributed under an Apache v2 open source license on GitHub.

Step 1. Install NVIDIA CUDA:

To use TensorFlow with NVIDIA GPUs, the first step is to install the CUDA Toolkit.

Step 2. Install NVIDIA cuDNN:

@cafuego
cafuego / 2842739-14.patch
Created August 17, 2018 08:46
PWA module 404 fix
diff --git a/pwa.module b/pwa.module
index a87172b..fe22fe9 100644
--- a/pwa.module
+++ b/pwa.module
@@ -27,7 +27,7 @@ function pwa_permission() {
function pwa_menu() {
$items = [];
- $items['pwa/serviceworker.js'] = [
+ $items['pwa/serviceworker/js'] = [
#!/bin/bash
#
# Wait for the system load to hit a set level. Can be used in init
# scripts to avoid insane load spikes. Use the return value to abort
# starting processes if the load remains too high.
#
# wait_timeout.sh 4 || exit 0
# Default sleep interval in seconds.
SLEEP=30
<?php
function theme_service_links_build_link($variables) {
$text = $variables['text'];
$url = $variables['url'];
$image = $variables['image'];
$nodelink = $variables['nodelink'];
$style = $variables['style'];
$attributes = $variables['attributes'];
if ($nodelink) {
@cafuego
cafuego / quicktabs persist
Created December 23, 2013 00:56
Re-open a quicktab after clicking a link under said tab (for a quicktabs view)
(function ($) {
Drupal.qtpersist = Drupal.qtpersist || {};
Drupal.behaviors.qtpersist = {
attach: function (context, settings) {
$.extend(true, Drupal.settings, settings);
$('.quicktabs-wrapper', context).once(function(){
Drupal.qtpersist.prepare(this);
});
<?php
/**
* Implements hook_date_views_extra_tables().
*/
function webform_date_views_extra_tables() {
return array('webform_submissions' => 'webform_submissions');
}
$('#element').replaceWith('<div id="element">Reloading...</div>');
$.ajax({
type: 'POST',
url: '/js/element-callback',
dataType: 'json',
success: function (data) {
if (data.element) {
// Push the result into the wrapper div.
$('#element').replaceWith('<div id="element">' + data.element + '</div>');
}
@cafuego
cafuego / gist:6418333
Created September 3, 2013 00:01
mess with Drupal 7 status messages
/**
* Implements hook_preprocess_status_messages().
*
* Remove the login warning message, anon users can only see the login form anyway.
*/
function intranet_preprocess_status_messages(&$vars) {
$messages = drupal_get_messages('error');
if (!empty($messages['error'])) {
$errors = $messages['error'];
foreach ($errors as $error) {
@cafuego
cafuego / my.cnf
Created May 5, 2013 23:43
my.cnf for the replication slave that does backup dumps
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
@cafuego
cafuego / drush-make-wc.patch
Created May 2, 2013 00:25
Allow drush_make to keep a working-copy of a project.
diff --git a/drush_make.orig/drush_make.download.inc b/drush_make/drush_make.download.inc
index 92c68f9..2bd0bb5 100644
--- a/drush_make.orig/drush_make.download.inc
+++ b/drush_make/drush_make.download.inc
@@ -345,6 +345,7 @@ function drush_make_download_post($name, $download, $download_location) {
function drush_make_download_git($name, $download, $download_location) {
$tmp_path = drush_make_tmp();
$wc = drush_get_option('working-copy');
+ $wc = (!empty($download['working-copy'])) ? $download['working-copy'] : $wc;