Skip to content

Instantly share code, notes, and snippets.

View zetok's full-sized avatar

zetok

  • tox:29AE62F95C56063D833024B1CB5C2140DC4AEB94A80FF4596CACC460D7BAA062E0A92C3424A0
View GitHub Profile
@alexbakker
alexbakker / Program.cs
Created August 29, 2015 11:33
Bootstrapinfo example
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace BootstrapCheck
{
class Program
{
static int tries = 5;

Why so slow? Creating a flamegraph of your program with perf

Flamegraphs can help to optimize the program a lot. So let's create one!

  • Install perf with use flag unwind enabled
  • Download flamegraph.pl and stackcolllapse-perf.pl
  • Run perf record -F 99 --call-graph dwarf -- ‹your program›
  • Do all the things that make your program slow
  • Close your program
  • Run perf script | stackcollapse-perf.pl > out.folded
@stengland
stengland / bbcradio.sh
Last active January 11, 2023 14:53
Play BBC Radio with mpd or mplayer from the command line
#!/bin/bash
play() {
playlist="http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_$1.m3u8"
echo $playlist
if mpc
then
mpc add $playlist
mpc play
else
mplayer $playlist