Skip to content

Instantly share code, notes, and snippets.

View AfonsoFGarcia's full-sized avatar

Afonso Garcia AfonsoFGarcia

View GitHub Profile
@AfonsoFGarcia
AfonsoFGarcia / audio-control
Created June 24, 2020 22:16
Switch audio ouputs from the command line in Ubuntu
#!/bin/bash
# Define the name of the sinks to use
readonly HEADPHONES="alsa_output.usb-Roland_DUO-CAPTURE-00.analog-stereo"
readonly SPEAKERS="alsa_output.pci-0000_0d_00.4.iec958-stereo"
# Get the current sink
currentSink=$(pactl info | grep "Default Sink" | awk '{print $3}')
# Based on the current sink, switch between cards
@AfonsoFGarcia
AfonsoFGarcia / Music.java
Last active August 29, 2015 14:11
Let AES produce music for you!
import org.jfugue.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import java.io.*;
import java.security.*;
public class Music {
static String keyEnc = "a tua prima de 4";
public static void main(String[] args) throws Exception {
AlertDialog.Builder alert = new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_LIGHT);
alert.setTitle(title);
alert.setCancelable(false);
AlertDialog dialog;
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {