Instantly share code, notes, and snippets.

View bench.do
SetActiveLib -work
comp -include "$dsn\src\Komponentai.vhd"
comp -include "$dsn\src\Naturali_Top.vhd"
comp -include "$dsn\src\TestBench\Naturali_Top_TB.vhd"
asim +access +r TESTBENCH_FOR_Naturali_top
wave
wave -noreg sinchr1
wave -noreg sinchr2
wave -noreg sinchr3
wave -noreg sinchr4
View one-way-sync.sh
#!/bin/sh
# Dir to watch
SOURCE_DIR="/tmp/source/"
# Dir to sync
TARGET_DIR="/tmp/target/"
inotifywait -mr --timefmt '%y-%m-%d %H:%M' --format '%T %w %f %e' \
-e modify \
-e attrib \
View helper.js
// var context = {foo: true, bar: false, baz: true}
// {{#and foo baz}}Yup{{else}}Nope{{/and}} -> Yup
// {{#and bar baz qux}}Yup{{else}}Nope{{/and}} -> Nope
Handlebars.registerHelper('and', function() {
var fncType = toString.call(function(){});
for (var i = 0; i < arguments.length - 1; i++) {
var arg = arguments[i];
if (toString.call(arg) === fncType) {
arg = arg.call(this);
View helper.js
// var context = {foo: true}
// {{#or foo bar baz}}Yup{{else}}Nope{{/or}} -> Yup
// {{#or bar baz}}Yup{{else}}Nope{{/or}} -> Nope
Handlebars.registerHelper('or', function() {
var fncType = toString.call(function(){});
for (var i = 0; i < arguments.length - 1; i++) {
var arg = arguments[i];
if (toString.call(arg) === fncType) {
arg = arg.call(this);
View gravatar.sh
#! /bin/bash
me=$(logname)
echo "Type in the email you use with gravatar: "
read email
md5=$(echo -n $email | md5sum | cut -f1 -d' ')
echo "Fetching image to /var/lib/AccountsService/icons/$me..."
wget --quiet http://www.gravatar.com/avatar/$md5?s=128 --output-document="/var/lib/AccountsService/icons/$me"
echo "Setting image..."
echo Icon=/var/lib/AccountsService/icons/$me >> /var/lib/AccountsService/users/$me
echo "Done"