Skip to content

Instantly share code, notes, and snippets.

ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
Jan 01 07:09 : alsa_output: Failed to open "Pi Speakers" [alsa]: Failed to open ALSA device "default": No such file or directory
Jan 01 07:09 : output: Failed to open audio output
@Bolt64
Bolt64 / natural_selection.py
Last active August 29, 2015 14:06
A natural selection simulator and graph plotter made for UB101 assignment
#!/usr/bin/env python3
"""
Author: Sayantan Khan
Date: 8th September, 2014
"""
import matplotlib.pyplot as plt
import random
#!/bin/bash
# Install the application imagemagick before using this script
TARGET_DIR=$1 # Unzip the file and the folder is the first argument
mkdir target # A temporary directory to hold the images
find "$TARGET_DIR" -name "*.jpg" -print0 | xargs -0 cp -t ./target
convert ./target/*.jpg output.pdf # output.pdf is the name of the output file
rm -r target
def check_bit4(inp):
if inp & 16 > 0: # 16 is just 0b1000
return "on"
else:
return "off"
@Bolt64
Bolt64 / show.scala
Created June 25, 2015 10:46
Showing that type erasure happens at compile time
object Temp {
def a(r: List[Int]): List[Int] = {
r map ((x: Int) => x*2)
}
def a(r: List[String]): List[String] = {
r map ((x: String) => x*2)
}
}
@Bolt64
Bolt64 / algorithmic_complexity.c
Created July 6, 2015 19:04
A problem set for algorithmic complexity
#include <stdio.h>
#include <stdlib.h>
// All important code here
// Following the code, there are questions related to the code
// which you need to solve.
float power(float x, int n) { // Calculates the float x raised to n
if(n>=0) {
float result = 1;
import scala.util.Random
object HashCollide {
def gen_random_lists(size: Int, upper: Int) = {
val s = Random.nextInt(size)
(1 to s).toList map (_ => Random.nextInt(upper))
}
def gen_list_of_list(size1: Int, size2: Int = 10, upper: Int = 20) = {
((1 to size1).toList map (_ => gen_random_lists(size2, upper))).distinct
#!/usr/bin/env python3
def sanitize(dens, amount):
return tuple(filter(lambda x: x<=amount, dens))
def memoize(func):
cache = {}
def inner(dens, amount):
dens = sanitize(dens, amount)
if not (dens, amount) in cache:
#!/bin/bash
array=("a" "b" "c" "d" "e")
length=${#array[@]}
for i in $(seq 0 $(($length - 2)));
do
for j in $(seq $(($i + 1)) $(($length - 1)));
do
echo ${array[i]} ${array[j]}
# .latexmkrc starts
$pdf_mode = 1;
$pdflatex .= ' && (cp "%D" "%R.pdf"; echo Output file copied from "%D" to "%R.pdf" in current directory)';
$out_dir = 'build';
# .latexmkrc ends