Skip to content

Instantly share code, notes, and snippets.

@the-spyke
the-spyke / pipewire.md
Last active September 18, 2024 06:27
Enable PipeWire on Ubuntu 22.04

Enable PipeWire on Ubuntu 22.04

This guide is only for original Ubuntu out-of-the-box packages. If you have added a custom PPA like pipewire-debian, you might get into conflicts.

Ubuntu 22.04 has PipeWire partially installed and enabled as it's used by browsers (WebRTC) for recoding the screeen under Wayland. We can enable remaining parts and use PipeWire for audio and Bluetooth instead of PulseAudio.

Starting from WirePlumber version 0.4.8 automatic Bluetooth profile switching (e.g. switching from A2DP to HSP/HFP when an application needs microphone access) is supported. Jammy (22.04) repos provide exactly version 0.4.8. So, we're good.

Based on Debian Wiki, but simplified for Ubuntu 22.04.

@ChrisBarker-NOAA
ChrisBarker-NOAA / conda_compare.py
Created September 19, 2018 08:14
Python Script to compare two conda environments
#!/usr/bin/env python2
"""
quicky script that compares two conda environments
can be handy for debugging differences between two environments
This could be made much cleaner and more flexible -- but it does the job.
Please let me know if you extend or improve it.
@brambow
brambow / postgis-to-geojson-feature-collection.sql
Last active April 25, 2023 15:44
PostGIS query to build a GeoJSON FeatureCollection
SELECT json_build_object(
'type', 'FeatureCollection',
'crs', json_build_object(
'type', 'name',
'properties', json_build_object(
'name', 'EPSG:4326'
)
),
'features', json_agg(
json_build_object(
@eatnumber1
eatnumber1 / renameat2.c
Last active August 18, 2024 22:47
Command-line tool to call renameat2(2)
/*
* Copyright (c) 2023 Russell Harmon
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@pjz
pjz / docker-start-huginn
Last active February 12, 2021 03:17
An idempotent start script for huginn under docker
#!/bin/bash
## these need to be set
# initial account credentials
SEED_USER=admin
SEED_PASS=password
# required for new users to be able to sign up ; default to something random
INVITATION_CODE=`dd if=/dev/urandom bs=1024 count=1 | md5sum -`
@remram44
remram44 / ipython-script.py
Created July 22, 2014 22:00
ipython-script.py
#!C:\Python2.7\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'ipython==2.1.0','console_scripts','ipython'
__requires__ = 'ipython==2.1.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('ipython==2.1.0', 'console_scripts', 'ipython')()
)

Sublime Text 2 Useful Shortcuts

Tested in Mac OS X| super == command (⌘)

Open/Goto

Shortcut Action
super+t go to file
super+ctrl+p go to project
@rclark
rclark / Issues.md
Last active July 9, 2024 20:16
Leaflet WMS + GetFeatureInfo

There are a bunch of reasons why this is convoluted, mostly in building the URL to make the request:

  1. You have to rely on an AJAX request, this example uses jQuery
  2. To make a GetFeatureInfo request, you must provide a BBOX for a image, and the pixel coordinates for the part of the image that you want info from. A couple of squirrely lines of Leaflet code can give you that.
  3. Output formats. The info_format parameter in the request. We don't know a priori which will be supported by a WMS that we might make a request to. See Geoserver's docs for what formats are available from Geoserver. That won't be the same from WMS to WMS, however.
  4. WMS services return XML docs when there's a mistake in the request or in processing. This sends an HTTP 200, which jQuery doesn't think is an error.
@madjar
madjar / counterexample_tpb.py
Created September 23, 2013 13:42
An attempt to find the perfect scrapper form
import re
from collections import namedtuple
import requests
from bs4 import BeautifulSoup
Torrent = namedtuple('Torrent', 'name link magnet torrent created size'
' user seeders leechers')
@remram44
remram44 / logstack.py
Created September 13, 2013 20:43
Adds context to your stack traces
import contextlib
import linecache
import logging
import sys
import traceback
try:
import cStringIO as StringIO
except ImportError:
import StringIO