Skip to content

Instantly share code, notes, and snippets.

View xspager's full-sized avatar
🐼

Daniel Lemos xspager

🐼
View GitHub Profile
@xspager
xspager / read_flac.c
Last active January 8, 2022 17:32
Reads a FLAC file metadata, only the first block for now
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#define BUFFER_SIZE 4096
typedef struct {
@xspager
xspager / hget.cpp
Last active November 29, 2020 13:54
SerenityOS "hget"
#include <AK/ByteBuffer.h>
#include <AK/SharedBuffer.h>
#include <AK/URL.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
#include <LibCore/File.h>
#include <LibProtocol/Client.h>
#include <LibProtocol/Download.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
/*
Frase1: Em de espeto de
Frase2: casa ferreiro eh pau
Frase3: Em casa de ferreiro espeto eh de pau
*/
char frase1[] = "Em de espeto de";
char frase2[] = "casa ferreiro eh pau";
@xspager
xspager / auth.py
Created August 22, 2018 20:06
Example of how to do a server side authorization and restricted access to Mercadolibre/Mercadolivre API using Flask in a single file.
import os
import json
import requests as req
from flask import Flask, Response, redirect, request
app = Flask(__name__)
'''
Example of how to do a server side authorization and restricted access to Mercadoli[bre|vre] API using Flask in a sigle file.
@xspager
xspager / lg_remote.ino
Last active February 9, 2018 03:06
Arduino iRemote example for sending remote control commands to a LG Home Theater from the serial port
/*
* IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
* An IR LED must be connected to Arduino PWM pin 3.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
@xspager
xspager / linux_input_mouse.c
Created September 11, 2017 13:24
simple test for linux input mouse with relative position
#include <linux/input.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
int fd, i;
local target = terralib.newtarget {
--Triple = "x86_64-apple-darwin";
Triple = "x86_64-pc-linux";
-- CPU = "";
Features = "";
}
local C = terralib.includecstring([[
#include <stdio.h>
typedef struct {
local C = terralib.includec("stdio.h")
local intel_x86_target = terralib.newtarget {
Triple = "x86_64-apple-darwin";
-- CPU = ;
Features = "+sse,+mmx";
}
struct Person {
age: int
@xspager
xspager / temp.py
Created June 23, 2016 22:27
Keep showing the temperature of the Zynq chip (tested on the Parallella board)
#!/usr/bin/env python2
# coding: utf-8
# based on https://github.com/parallella/parallella-utils/blob/master/xtemp/xtemp.c
import time
offset = int(open("/sys/bus/iio/devices/iio:device0/in_temp0_offset").read())
scale = float(open("/sys/bus/iio/devices/iio:device0/in_temp0_scale").read())
raw_temp_file = open("/sys/bus/iio/devices/iio:device0/in_temp0_raw")
server {
listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /usr/home/freebsd/xspager;
index index.lua;
# Make site accessible from http://ablogusingsailor.danielocl.com.br/
server_name ablogusingsailor.danielocl.com.br;