Skip to content

Instantly share code, notes, and snippets.

View niccottrell's full-sized avatar
🏠
Working from home

Nicholas Cottrell niccottrell

🏠
Working from home
View GitHub Profile
@steffenr
steffenr / url.php
Last active March 24, 2016 10:51
Create link with attributes in Drupal 8
<?php
$link_url = Url::fromRoute('node.add', array('node_type' => $content_type));
$link_url->setOptions(array(
'attributes' => array(
'class' => array('button')
),
'query' => \Drupal::destination()->getAsArray(),
));
$link_text = t('Add !content_type content', array('!content_type' => ucfirst($content_type)));
// Build link
@niccottrell
niccottrell / mongodb-arbiter.conf
Created August 14, 2014 09:22
mongodb arbiter configuration file (shard)
systemLog:
destination: file
path: "/var/log/mongo/mongo-arb.log"
logAppend: true
storage:
dbPath: "/var/lib/mongo-arb"
processManagement:
fork: true
pidFilePath: "/var/run/mongo/mongod-arb.pid"
net:
@fkei
fkei / backup.py
Created August 23, 2012 06:27 — forked from rore/backup.py
A script to automate freezing XFS and locking MongoDB and snapshotting EBS volumes
#!/usr/bin/env python
from __future__ import with_statement
import contextlib
import logging
import os
import sys
import urllib2
from boto.ec2.connection import EC2Connection
@srpouyet
srpouyet / mongodb
Created February 29, 2012 17:14
Mongodb logrotate on Ubuntu
# Put this in /etc/logrotate.d/mongodb
# http://stackoverflow.com/questions/5004626/mongodb-log-file-growth
/var/log/mongo/*.log {
daily
rotate 30
compress
dateext
missingok
notifempty
@smitshilu
smitshilu / Tensorflow_Build_GPU.md
Last active June 9, 2020 18:27
Tensorflow 1.4 Mac OS High Sierra 10.13 GPU Support

Tensorflow

System information

  • OS - High Sierra 10.13
  • Tensorflow - 1.4
  • Xcode command line tools - 8.2 (Download from here: Xcode - Support - Apple Developer & Switch to different clang version: sudo xcode-select --switch/Library/Developer/CommandLineTools & check version: clang -v)
  • Cmake - 3.7
  • Bazel - 0.7.0
@RedBeard0531
RedBeard0531 / functions.js
Created February 22, 2012 20:13
Min, Max, Sum, Count, Avg, and Std deviation using MongoDB MapReduce
// derived from http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
function map() {
emit(1, // Or put a GROUP BY key here
{sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count:1,
diff: 0, // M2,n: sum((val-mean)^2)
});
@drewjoh
drewjoh / custom.js
Created January 27, 2012 13:55
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.1)
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@jganzabal
jganzabal / Nvidia Titan XP + MacBook Pro + Akitio Node + Tensorflow + Keras.md
Last active November 2, 2022 11:43
How to setup Nvidia Titan XP for deep learning on a MacBook Pro with Akitio Node + Tensorflow + Keras
@eranation
eranation / gist:3241616
Created August 2, 2012 22:51
MongoDB Aggregation Framework way for "select count (distinct fieldName) from someTable" for large collections
//equivalent of "select count (distinct fieldName) from someTable"
db.someCollection.aggregate([{ $group: { _id: "$fieldName"} },{ $group: { _id: 1, count: { $sum: 1 } } } ])
@zhovner
zhovner / etckeeper.sh
Created February 5, 2013 18:02
etckeeper setup with bitbucket repo
# После установки etckeeper
/etc/etckeeper/etckeeper.conf VCS="git"
etckeeper init && etckeeper commit
# ------
git config --global user.name "My Machine"
git config --global user.email "etckeeper@my.machine"