Skip to content

Instantly share code, notes, and snippets.

@connorjan
connorjan / shairport-sync-install.md
Last active December 16, 2023 13:22
shairport-sync installation for a Raspberry Pi
@stevemclaugh
stevemclaugh / Lightweight Speech to Text with PocketSphinx.ipynb
Created December 20, 2016 05:17
Simple, fast, reasonably accurate speech-to-text processing for audio recordings of speech.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Ruby Association Certified Ruby Examination Silver Sample Questions

Q1. Which of the following have true values in Ruby? (Choose two.)

  • (a) ""
  • (b) 0
  • (c) false
  • (d) nil

@foo123
foo123 / smoothState-wordpress.js
Last active December 5, 2018 19:30
smoothState - wordpress integration scripts
!function( $ ){
"use strict";
// include modified jquery.execReeady.js RIGHT AFTER jquery script, to handle onReady as mod exec
// the approach taken here is this:
// only the absolutely necessary assets (scripts/styles) should be included in ALL pages (e.g jquery, jquery.execReday, smoothState.js, smoothState-wordpress.js)
// all other assets (scripts/styles) per specific page should be included INSIDE the page part handled by smoothState, this script will make sure everything will load and init as transparently as possible
// the smoothState container element is #page and the replaced element is #page > .site.inner which should have a class .page-transition as well
// the transitions are parametrisable through some global settings under window.WPSmoothStateOptions which includes duration, inTransition, outTransition classes
// but one can change that if one wishes, this is quite generic since i use libraries of css-based animations with lots of options, so i find this more generic and parametrisable at wil
@pachacamac
pachacamac / codepenclone.html
Created April 29, 2016 12:52
Mini Codepen Clone with sharing function
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MiniCodepenClone</title>
<style>
body,textarea,iframe{ margin:0; box-sizing:border-box; }
textarea,iframe { width:100%; height:50vh; float:left; }
textarea { color:#eee; background:#111; font-family:monospace; font-size:11pt; line-height:1.4; width:33.33%; }
#shareBtn { position:absolute; bottom:0; left:0; }
@kindleton
kindleton / crf_accuracy.py
Created March 1, 2016 23:37
Calculate accuracy for CRF++ output file
import sys
f1 = open(sys.argv[1])
count = 0
true = 0
false = 0
sentences = 0
for line in f1:
if line == '\n' or line.split()==[]:
sentences+=1
@drakmail
drakmail / example.rb
Created December 11, 2015 07:37
Bulk update example in ActiveRecord Rails
new_values = { 10 => "test1", 20 => "test2" }
value = new_values.map { |product_id, value| "(#{product_id}, #{value})" }.join(",")
ActiveRecord::Base.connection.execute(%(
UPDATE products AS p SET value = v.value
FROM (values #{values}) AS v(id, value)
WHERE p.id = v.id
))
@mblondel
mblondel / seminb.py
Created October 28, 2015 12:50
Semi-supervised Naive Bayes
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Mathieu Blondel
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@shazow
shazow / convert-gifs.sh
Last active January 22, 2024 10:13
Batch convert a directory of gifs into mp4
#!/usr/bin/bash
# Convert *.gif into *.mp4, skip if already exists.
outdir="."
for path in *.gif; do
out="${outdir}/${path/.gif/}.mp4"
[[ -f "$out" ]] && continue
ffmpeg -f gif -i "${path}" "${out}"
done