Skip to content

Instantly share code, notes, and snippets.

View iamricard's full-sized avatar
🐕‍🦺

Ricard Solé iamricard

🐕‍🦺
View GitHub Profile
@iamricard
iamricard / Game.cpp
Created March 30, 2014 21:04
sdl2, box2d, cmake
// Copyright 2014-present [Ricard Sole <@rcsole, ricard.solecasas@gmail.com>]
#include <cstdio>
#include "./Game.h"
bool Game::init(const char* title, int xpos, int ypos, int width,
int height, int flags) {
if (SDL_Init(SDL_INIT_EVERYTHING) == 0) {
printf("SDL_Init success\n");
@iamricard
iamricard / Dosificador.php
Created August 31, 2014 13:11
PHP example
<?php
class Dosificador {
private $name;
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
<html>
<style>
pre {
height: 25px;
overflow: hidden;
}
.expanded {
height: auto;
}
// A simple Particle class
window.Particle = function(position, acceleration) {
this.acceleration = createVector(0, acceleration || 0.15);
this.velocity = createVector(random(-1, 1), random(-1, 0));
this.position = position.copy();
this.lifespan = 255.0;
};
Particle.prototype.run = function() {
this.update();
@iamricard
iamricard / app.js
Created September 16, 2015 07:32
Spotify artist search
(function() {
function artistElement(artist) {
var img = artist.images[0] || { url: 'http://placehold.it/64x64' }
return `
<div class="media artist" data-id="${artist.id}">
<div class="media-left">
<img class="media-object" src="${img.url}" />
</div>
@iamricard
iamricard / cacl_time.java
Created April 21, 2013 10:19
personal_management
/*
author: @grumpylion
description: does the calculations with the punchcard variable as input
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class funciones {
private static BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
public int how_many_times(String movies_array[][], String rent_array[][]) throws IOException {
String input,
#!/bin/bash
## author @grumpylionking
createuser()
{
echo "desired user name: "
read user
echo "desired group name: "
read group
#!/bin/bash
## author : Ricard Sole Casas
## description : Script that captures input by nfc-list and does what you tell it to do
## twitter : @codinglion
## github : http://github.com/codinglion
## gist : http://gist.github.com/codinglion
while true; do
input=`nfc-list | grep UID | cut -d ":" -f 2 | sed 's/ //g'`
$ sudo apt-get install samba
$ sudo vi /etc/samba/smb.conf
# look for workgroup = WORKGROUP and change WORKGROUP for the workgroup name you set up on Windows
# look for the line #security = user and uncomment it
# save and exit
$ sudo echo -e "[sharedfolder]\n\tpath = /path/to/share/folder\n\tbrowsable = yes\n\tguest ok = no\n\tread only = yes\n\tcreate mask = 0755" >> /etc/samba/smb.conf
$ sudo smbpasswd -a `whoami`
$ sudo restart smbd && sudo restart nmbd