Skip to content

Instantly share code, notes, and snippets.

@padakuro
padakuro / nvidia-power-limit.service
Created July 3, 2016 13:36
Set power limit of an nVidia card on startup
[Unit]
Description=set nvidia power limit
[Service]
Type=oneshot
ExecStartPre=/usr/bin/nvidia-smi --persistence-mode=1
ExecStart=/usr/bin/nvidia-smi --power-limit=60
RemainAfterExit=yes
[Install]
@padakuro
padakuro / hashtest.php
Created February 4, 2014 06:39
php hash_file benchmark (requires dd for temp file generation)
<?php
// will be passed to dd as bs=
$sizes = ['1K', '10K', '100K', '1M', '10M', '25M', '50M', '100M'];
// http://de3.php.net/manual/en/function.hash-algos.php
$algos = ['md5', 'sha256', 'sha512', 'ripemd320', 'whirlpool'];
echo "After test, please remove all *.hashtest temporary files in this directory\n";
echo "Preparing temporary files...\n";
@padakuro
padakuro / renderer.coffee
Created April 3, 2013 14:37
simple backbone marionette handlebars renderer (coffee script)
do ->
templateCache = {}
Backbone.Marionette.Renderer.render = (template, data) ->
if templateCache[template]
tpl = templateCache[template]
else
source = $("script[data-template-name='#{template}']");
unless source.length > 0