Skip to content

Instantly share code, notes, and snippets.

View agundy's full-sized avatar

Aaron Gunderson agundy

View GitHub Profile
@egelev
egelev / connect_bluetooth_headphones.sh
Last active April 26, 2024 14:14
Connect bluetooth headphones on Ubuntu 18.04
#!/usr/bin/env bash
function get_headphones_index() {
echo $(pacmd list-cards | grep bluez_card -B1 | grep index | awk '{print $2}')
}
function get_headphones_mac_address() {
local temp=$(pacmd list-cards | grep bluez_card -C20 | grep 'device.string' | cut -d' ' -f 3)
temp="${temp%\"}"
temp="${temp#\"}"
@andy-thomason
andy-thomason / Genomics_A_Programmers_Guide.md
Created May 14, 2019 13:32
Genomics a programmers introduction

Genomics - A programmer's guide.

Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.

https://www.genomicsplc.com

@wosephjeber
wosephjeber / instructions.md
Last active May 21, 2024 08:27
Ecto migration for renaming table with indexes and constraints

Renaming table in Ecto migration

I recently wanted to rename a model and its postgres table in a Phoenix app. Renaming the table was simple and documented, but the table also had constraints, sequences, and indexes that needed to be updated in order for the Ecto model to be able to rely on default naming conventions. I couldn't find any examples of what this would look like but was eventually able to figure it out. For anyone else in the same situation, hopefully this example helps.

In the example below, I'm renaming the Permission model to Membership. This model belongs to a User and an Account, so it has foreign key constraints that need to be renamed.

defmodule MyApp.Repo.Migrations.RenamePermissionsToMemberships do
  use Ecto.Migration
@boriscy
boriscy / description.md
Last active March 19, 2020 19:50
Phoenix + React + Elm config with webpack

Attemp to make work react with elm on a phoenix project.

The project directory for elm is

web
├── channels
├── controllers
│   └── api
│   └── v1
@simonmichael
simonmichael / accounts.txt
Last active May 30, 2023 09:43
a sample *ledger chart of accounts (first 3 levels): combined personal & business, eg for a freelancer
assets
business
accounts receivable
bank
personal
accounts receivable
bank
cash
gifts
online
@seveibar
seveibar / roc.bash
Last active August 29, 2015 13:56
Used on my system to run a command on any change in a file in the current directory
#!/bin/bash
# RUN ON CHANGE
if [[ "$unamestr" == 'Linux' ]]; then
while [ 1 ]; do
clear\
&& echo "[Running \"$@\" on files changes in $(pwd) at $(date +'%r')]"\
&& echo ""\
&& echo "$@" > /home/seve/Desktop/lastroc.sh\
@wandernauta
wandernauta / sp
Last active May 14, 2024 16:49
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style

@X4
X4 / krawall.sh
Last active January 7, 2018 09:55
Krawall is a "Wallpaper Changer" for all common desktop environments (xfce4, i3/xmonad, enlightenment (e17), gnome2, gnome3, kde3 and kde4)
#!/bin/bash
# -------------------------------------------------------
# @author X4
# @version 1.0
#
# HowTo:
# You can add a new GlobalHotkey to the media forward an back buttons for example.
# There are other ways to run this script: Button or Keypresses, Plasmoids, Events..
#
# Use these parameters when on XFCE for example:
@THeK3nger
THeK3nger / audio.py
Last active September 1, 2023 21:35
Python Wave Audio Loop
import os
import wave
import threading
import sys
# PyAudio Library
import pyaudio
class WavePlayerLoop(threading.Thread) :
"""