Skip to content

Instantly share code, notes, and snippets.

View thiagokokada's full-sized avatar

Thiago Kenji Okada thiagokokada

View GitHub Profile
@thiagokokada
thiagokokada / .gitignore
Last active August 29, 2015 14:19
Testing if-guards in OpenMP
max_vector
max_vector.c
@thiagokokada
thiagokokada / Makefile
Last active August 29, 2015 14:20
Testing 2D matrix serialization in C using tpl
CC = clang
CFLAGS = -std=gnu99 -O3 -Wall
all: matrix_gen
matrix_gen: matrix_gen.o tpl.o
$(CC) $(CFLAGS) matrix_gen.o tpl.o -o matrix_gen
matrix_gen.o: matrix_gen.c
$(CC) $(CFLAGS) -c matrix_gen.c
@thiagokokada
thiagokokada / Makefile
Created May 1, 2015 01:30
Matrix multiplication in (Open)MPI
CC = mpicc
CFLAGS = -std=gnu99 -O3 -Wall
# OMPI_MPICC = clang
all: matrix_mul
matrix_mul: matrix_mul.c matrix_mul.h
ifdef OMPI_MPICC
env OMPI_MPICC=$(OMPI_MPICC) $(CC) $(CFLAGS) -o matrix_mul matrix_mul.c
else
@thiagokokada
thiagokokada / example_intro.cu
Created May 5, 2015 02:03
Matrix sum in CUDA
#include <assert.h>
#include <cuda.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
/* Example from "Introduction to CUDA C" from NVIDIA website:
https://developer.nvidia.com/cuda-education
Compile with:
@thiagokokada
thiagokokada / Makefile
Created June 26, 2015 16:15
Matrix Multiplication using (Open)MPI
CC = mpicc
CFLAGS = -std=gnu99 -O3 -Wall
# OMPI_MPICC = clang
all: matrix_mul
matrix_mul: matrix_mul.c matrix_mul.h
ifdef OMPI_MPICC
env OMPI_MPICC=$(OMPI_MPICC) $(CC) $(CFLAGS) -o matrix_mul matrix_mul.c
else
@thiagokokada
thiagokokada / [Arch Linux] auto_upgrade
Last active June 9, 2018 05:33
Get e-mail notifications of updates in Arch Linux
Auto-upgrade Arch Linux or get e-mail in case of failure.
@thiagokokada
thiagokokada / rotate_desktop.sh
Last active September 18, 2016 03:07 — forked from mildmojo/rotate_desktop.sh
Script to rotate the screen and touch devices on modern Linux desktops. Great for convertible laptops.
#!/bin/bash
#
# rotate_desktop.sh
#
# Rotates modern Linux desktop screen and input devices to match. Handy for
# convertible notebooks. Call this script from panel launchers, keyboard
# shortcuts, or touch gesture bindings (xSwipe, touchegg, etc.).
#
# Using transformation matrix bits taken from:
# https://wiki.ubuntu.com/X/InputCoordinateTransformation
@thiagokokada
thiagokokada / i3lock-xkcd.py
Last active October 13, 2017 22:20
Downloads and show random xkcd comic as i3lock background
#!/usr/bin/env python3
# i3lock-xkcd.py
# Downloads and show random xkcd comic as i3lock background
import os
import sys
from subprocess import run
from tempfile import NamedTemporaryFile
from textwrap import wrap
@thiagokokada
thiagokokada / dynupdate.py
Last active October 31, 2017 02:09
Script to update now-dns.com IPv4/v6 address
#!/usr/bin/env python3
# Script to update now-dns.com IPv4/v6 address
# Based on https://now-dns.com/client/dynupdate.pl
# Depends on python3 and python3-requests installed in the system
import os
import re
import requests
@thiagokokada
thiagokokada / lock_screen.py
Last active May 5, 2024 17:07
Lock screen using i3lock with background blur in Python
#!/usr/bin/env python
from subprocess import check_call, CalledProcessError
from tempfile import NamedTemporaryFile
from dpms import DPMS
from mss import mss
from PIL import Image, ImageFilter
GAUSSIAN_BLUR_RADIUS = 5