Skip to content

Instantly share code, notes, and snippets.

@croddy
croddy / unbreak-bell.sh
Last active May 17, 2024 15:49
unbreak your X11 bell with pulseaudio
#!/bin/bash
# allegedly these bits can be done in a per-user default.pa, but i could not
# get it to work
pactl upload-sample /home/cmr/sounds/bells/soothingbell.wav soothingbell
pactl load-module module-x11-bell sample=soothingbell
# the default bell volume on my system is very quiet, but you should adjust this
xset b 100
# ...but the default output volume on my system is very loud. allegedly this can
# also be done in default.pa, but i could not get it to work even with pactl.
amixer -D pulse sset Master 50%
@eviatarbach
eviatarbach / flickr_exif.py
Last active March 9, 2019 05:46
A Python script for downloading files from Flickr with EXIF metadata intact. This can already be done with images from Pro users who choose not to hide their original image; however, this will work for all others, downloading the largest image size possible. It has problems with photos that have numbered EXIF tags; this seems to be something Fli…
#!/usr/bin/env python
import urllib
import os
import argparse
import flickrapi
api_key = '367aed513876077c1cdcadb29d88ef02'
api_secret = '9b6e223653519900'
@ae-s
ae-s / hexdump.c
Last active February 11, 2023 01:55
Hexdump suitable for debugging
#include <ctype.h>
#include <stdio.h>
void hexdump(void *ptr, int buflen) {
unsigned char *buf = (unsigned char*)ptr;
int i, j;
for (i=0; i<buflen; i+=16) {
printf("%06x: ", i);
for (j=0; j<16; j++)
if (i+j < buflen)
@aras-p
aras-p / preprocessor_fun.h
Last active April 29, 2025 01:49
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@natw
natw / fizzbuzz.py
Created November 15, 2012 16:22
best fizzbuzz
import random
for i in range(0, 100):
if not i % 15:
random.seed(1178741599)
print [i+1, "Fizz", "Buzz", "FizzBuzz"][random.randint(0,3)]