Skip to content

Instantly share code, notes, and snippets.

@tomwhipple
tomwhipple / dms2dec.py
Created September 2, 2012 16:25
convert DMS coordinates to decimal in Python
#!/env/python
# coding=utf8
"""
Converting Degrees, Minutes, Seconds formatted coordinate strings to decimal.
Formula:
DEC = (DEG + (MIN * 1/60) + (SEC * 1/60 * 1/60))
Assumes S/W are negative.
@avafloww
avafloww / PhpJava.java
Last active October 16, 2022 18:50
This snippet of code is syntactically valid in both PHP and Java, and produces the same output in both.
/*<?php
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s",
//\u000A\u002F\u002A
class PhpJava {
static function main() {
echo(//\u000A\u002A\u002F
"Hello World!");
}}
//\u000A\u002F\u002A
PhpJava::main();
@pazdera
pazdera / builder.cpp
Created August 2, 2011 20:33
Example of `builder' design pattern in C++
/*
* Example of `builder' design pattern.
* Copyright (C) 2011 Radek Pazdera
*
* 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 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@bcap
bcap / terminal-control.sh
Last active March 29, 2024 14:02
Useful terminal control characters
# Terminal output control (http://www.termsys.demon.co.uk/vtansi.htm)
TC='\e['
CLR_LINE_START="${TC}1K"
CLR_LINE_END="${TC}K"
CLR_LINE="${TC}2K"
# Hope no terminal is greater than 1k columns
RESET_LINE="${CLR_LINE}${TC}1000D"
@beeman
beeman / remove-all-from-docker.sh
Created November 15, 2016 03:04
Remove all from Docker
# Stop all containers
docker stop `docker ps -qa`
# Remove all containers
docker rm `docker ps -qa`
# Remove all images
docker rmi -f `docker images -qa `
# Remove all volumes
@dvf
dvf / change-codec.md
Last active April 12, 2024 06:15
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

@Piasy
Piasy / install_ffmpeg.sh
Last active April 14, 2024 05:40
brew install ffmpeg with all options
brew options ffmpeg
brew install ffmpeg \
--with-chromaprint \
--with-fdk-aac \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-game-music-emu \
--with-libass \