Skip to content

Instantly share code, notes, and snippets.

View andreibosco's full-sized avatar

Andrei B. B. Torres andreibosco

View GitHub Profile
@andreibosco
andreibosco / opengl.sublime-build
Last active January 14, 2017 18:49
sublime text 3: build and run C++ openGL code on linux
{
"cmd": ["g++ $file -o $file_base_name -L/usr/local/lib -lglut -lGL -lGLU"],
"shell": true,
"selector": "main.cpp",
"variants":
[
{
"name": "Run",
"cmd": "g++ $file -o $file_base_name -L/usr/local/lib -lglut -lGL -lGLU && ${file_path}/./${file_base_name}",
"shell": true
@andreibosco
andreibosco / gist:7575487
Created November 21, 2013 03:09
no sound on flash in linux

Put the code into into ~/.asoundrc

pcm.pulse { type pulse }
ctl.pulse { type pulse }
pcm.!default { type pulse }
ctl.!default { type pulse }
@andreibosco
andreibosco / gist:8082602
Created December 22, 2013 13:31
how to link to an unknown library
@andreibosco
andreibosco / gist:8246142
Created January 3, 2014 20:39
Wifi configuration on archlinux ARM

Fonte: http://raspberrypi.stackexchange.com/questions/7987/wifi-configuration-on-arch-linux-arm

The deprecated netcfg used /etc/network.d/ to store profiles. The successor of netcfg is netctl.

In order to setup a wireless network, install netctl using sudo pacman -S netctl. Next, you have to create a network profile. /etc/netctl/examples/ contains some examples. Let's assume you want to setup a WPA2-PSK network. Simply copy over the example file and start editing:

/etc/netctl# install -m640 examples/wireless-wpa wireless-home
/etc/netctl# cat wireless-home
Description='A simple WPA encrypted wireless connection'
@andreibosco
andreibosco / gist:8589922
Created January 24, 2014 00:43
restore windows 8 efi boot partition

Fonte: http://superuser.com/questions/460762/how-can-i-repair-the-windows-8-efi-bootloader

I've spent a lot of time trying to get my Windows 8 PC to boot again after cloning to a new SSD and try to summarise how I finally got it all working -

Firstly, boot from a UEFI Windows 8 recovery disk (CD/DVD/USB) - I found that the automated recovery process didn't find the correct Windows partition, nor when I managed to add it to BCD settings would it make it reliably bootable e.g. using BCDEDIT I got it to find and launch the Windows partition but it refused to cold boot or would not "keep" the settings after a 2nd reboot or power off.

Go into the Advanced options and run the Command Prompt.

Enter diskpart to use the DiskPart tool to ensure you have all the right partitions and to identify your EFI partition - the key thing here is that your EFI partition is formatted as FAT32:

@andreibosco
andreibosco / gist:8701532
Created January 30, 2014 02:28
Raspberry boot info
#!/bin/bash
IP_LOCAL=`hostname -i`
IP_EXTERNAL=`curl -s icanhazip.com`
HD_FREE=`df -Ph . | tail -1 | awk '{print $4}'`
OUTPUT=/tmp/rpi-info
rm /tmp/rpi-info
echo -e `date`'\n' >> $OUTPUT
echo -e "IP Local: $IP_LOCAL" >> $OUTPUT
echo -e "IP Externo: $IP_EXTERNAL\n" >> $OUTPUT
echo -e "Espaco disponivel: $HD_FREE" >> $OUTPUT
@andreibosco
andreibosco / gist:9745431
Last active August 29, 2015 13:57
Find all files containg text string - Linux

Fonte: http://www.ubuntu.com/download/desktop/create-a-usb-stick-on-mac-osx

  • Convert the .iso file to .img using the convert option of hdiutil: hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso
  • Run diskutil list to get the current list of devices.
  • Insert your flash media.
  • Run diskutil list again and determine the device node assigned to your flash media (e.g. /dev/disk2).
  • Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2).
  • Execute sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.imgor ./ubuntu.dmg).
    • Using /dev/rdisk instead of /dev/disk may be faster
  • Run diskutil eject /dev/diskN and remove your flash media when the command completes
@andreibosco
andreibosco / gist:11214628
Last active August 29, 2015 14:00
EDX: instalação e configuração no Ubuntu 14.04

Configurando sistema

Atualizar pacotes

sudo apt-get update -y
sudo apt-get upgrade -y
reboot

Instalar dependências

@andreibosco
andreibosco / edx.conf
Last active August 29, 2015 14:00
EDX - Supervisor: edx.conf
; EDX (lms e cms)
[program:lms]
command = /home/azureuser/apps/edx/bin/gunicorn_lms.sh
user = azureuser
stdout_logfile = /home/azureuser/apps/edx/log/gunicorn_lms_supervisor.log
redirect_stderr = true
[program:cms]