Skip to content

Instantly share code, notes, and snippets.

View dallarosa's full-sized avatar

Francisco Dalla Rosa Soares dallarosa

View GitHub Profile
@dallarosa
dallarosa / Test.java
Created September 28, 2014 06:46
Stackoverflow answer
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while(true){
System.out.println ("You enter a room and look around, in it, you see three doors, a red door labeled A, a blue door labeled B, and a green door labeled C. Which door do you choose to go through? Enter, A, B, or C");
String correctdoor = scanner.next();
if("A".equalsIgnoreCase(correctdoor)) {
break;
}
package main
import (
"io/ioutil"
"log"
"strings"
)
func main() {
input, err := ioutil.ReadFile("myfile")
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
char * int2bin(int i)
{
size_t bits = sizeof(int) * CHAR_BIT;
char * str = malloc(bits + 1);
if(!str) return NULL;
@dallarosa
dallarosa / check_spk.sh
Created November 1, 2015 16:35
Start chrome outputting sound to the soft volume device when the bluetooth speaker is connected
#!/usr/bin/bash
/usr/bin/hcitool con | grep -o 'DEVICE_MAC_ADDRESS' &> /dev/null
if [ $? -eq 0 ]
then PATH_TO_CHROME --alsa-output-device=softvol "$@"
else PATH_TO_CHROME
fi
.
.
.
<link rel="import" href="../bower_components/app-localize-behavior/app-localize-behavior.html">
.
.
.
<a name="view1" href="/view1">{{localize('hello','a','Batman')}}</a>
.
.
@dallarosa
dallarosa / challenge_skeleton.go
Created September 30, 2016 06:52
skeleton for any programming challenge
package main
import(
"fmt"
"bufio"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
@dallarosa
dallarosa / gist:7e3c6b48e6c54d32f19f24a5b95ac389
Last active March 6, 2018 09:20
install python3 and pip3
apt install python3 python3-pip
@dallarosa
dallarosa / install_jupyter.sh
Created March 6, 2018 09:31
Install jupyter and jupyterhub
pip3 install --upgrade notebook jupyterhub
@dallarosa
dallarosa / spectogram.py
Last active July 20, 2018 03:26
Spectogram images from audio for machine learning
#Based on http://www.frank-zalkow.de/en/code-snippets/create-audio-spectrograms-with-python.html
#This work is licensed under Creative Commons Attribution 3.0 International(Unported), according to the original work.
#Original Author: Frank Zalkow
#This Version's Author: Francisco Dalla Rosa Soares
import numpy as np
from matplotlib import pyplot as plt
import scipy.io.wavfile as wav
from numpy.lib import stride_tricks
import math
package main
import (
"encoding/hex"
"fmt"
)
func main() {
msg := "73616d706c652074657874"
bs, err := hex.DecodeString(msg)