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.
#!/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#\"}" |
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
Attemp to make work react with elm on a phoenix project.
The project directory for elm is
web
├── channels
├── controllers
│ └── api
│ └── v1
assets | |
business | |
accounts receivable | |
bank | |
personal | |
accounts receivable | |
bank | |
cash | |
gifts | |
online |
#!/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\ |
#!/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. | |
# |
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.
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.
#!/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: |
import os | |
import wave | |
import threading | |
import sys | |
# PyAudio Library | |
import pyaudio | |
class WavePlayerLoop(threading.Thread) : | |
""" |