Skip to content

Instantly share code, notes, and snippets.

View ianliu's full-sized avatar

Ian Liu Rodrigues ianliu

  • moray.ai
  • Campinas, Brazil
  • 17:04 (UTC -03:00)
  • LinkedIn in/ianliu88
View GitHub Profile
@ianliu
ianliu / bgchanger.sh
Last active December 12, 2015 04:28
This is a very simple script I did for changing the background in periods of time. The script was tested in Ubuntu 12.04.
#!/bin/bash
#
# Copyright 2013 Ian Liu Rodrigues <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
#!/bin/bash
#
# Copyright 2013 Ian Liu Rodrigues <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@ianliu
ianliu / example.c
Last active May 1, 2023 09:58
A simple profiler written in C
// compile with: gcc -std=gnu99 example.c profiler.c -lrt
#include "profiler.h"
#include <stdio.h>
FILE *devnull;
Profiler p_total;
Profiler p_foo8;
Profiler p_foo10;
// Run n! times
@ianliu
ianliu / FindC99.cmake
Created March 13, 2013 21:08
CMake module for searching for a compatible C99 compiler.
# - Finds C99 standard support
# This internally calls the check_c_source_compiles macro to determine the
# appropriate flags for a C99 standard compilation.
#=============================================================================
# Copyright 2013 Ian Liu Rodrigues <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@ianliu
ianliu / interpol.f90
Last active December 14, 2015 23:09
Interpolador de ???
PROGRAM interpol
Implicit none
double precision :: Y, X = 8.95
double precision :: s1, s2, p
integer :: n = 6, i, j
double precision,allocatable,dimension(:) :: xx, ff, ww
allocate(xx(n))
allocate(ff(n))
X = 8.95
xx = [1.4, 2.3, 4.0, 5.9, 10.0, 10.1]
n = len(xx)
ff = [x*x for x in xx]
ww = [1.0 for i in range(n)]
for i in range(n):
for j in range(n):
if i != j:
// compile with: gcc atomic-sum.c -lpthread
#define __STDC_FORMAT_MACROS
#include <pthread.h>
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <inttypes.h>
uint64_t sum = 0;
static int n_threads = 4;
@ianliu
ianliu / u
Created July 18, 2013 03:07
YouTube and FlashPlayer nevermore. When a video does not work with HTML5 in YouTube, click "Share > Embed", copy the text and execute "u" script. Voila!
#!/bin/bash
#
# Copyright (C) 2013 Ian Liu Rodrigues <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@ianliu
ianliu / checker.py
Created August 1, 2013 12:51
Generates a checker image in a binary format, for the ERAD-SP 2013 challange (http://erad.dc.ufscar.br/desafio.html)
import sys
from struct import pack
def usage():
sys.stderr.write("Usage: %s -w WIDTH -h HEIGHT [-s SIZE]\n" % \
(sys.argv[0], ))
sys.stderr.write(" -w WIDTH Image width\n")
sys.stderr.write(" -h HEIGHT Image height\n")
sys.stderr.write(" -s SIZE Size of the checkers (default 100)\n")
sys.exit(1)
@ianliu
ianliu / Makefile
Created December 5, 2013 10:55
A simple Makefile for cmake builds!
all clean: build build-opt
@$(MAKE) -s -C build $@
@$(MAKE) -s -C build-opt $@
build:
mkdir -p $@ ; cd $@ && \
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=Yes \
-DCMAKE_BUILD_TYPE=Debug ..
build-opt: