Skip to content

Instantly share code, notes, and snippets.

View xcapdevila's full-sized avatar

Xavier Capdevila xcapdevila

View GitHub Profile
@xcapdevila
xcapdevila / BasicERC20.sol
Created May 3, 2021 11:33 — forked from giladHaimov/BasicERC20.sol
Basic ERC20 implementation
pragma solidity ^0.4.19;
contract ERC20Basic {
string public constant name = "ERC20Basic";
string public constant symbol = "BSC";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
@xcapdevila
xcapdevila / text_preprocessing.py
Created May 23, 2020 18:12 — forked from jiahao87/text_preprocessing.py
Full code for preprocessing text
from bs4 import BeautifulSoup
import spacy
import unidecode
from word2number import w2n
from pycontractions import Contractions
import gensim.downloader as api
nlp = spacy.load('en_core_web_md')
# Choose model accordingly for contractions function
@xcapdevila
xcapdevila / README.md
Created July 12, 2018 08:16 — forked from xavriley/README.md
Original NES Mario Theme for Sonic Pi

Making Chiptune Music using Sonic Pi v2.0

Warning: this might not work on a RaspberryPi yet

I was curious about making retro gaming sounds using Sonic Pi. A couple of months and a lot of Googling later, here's the original Mario Bros theme as it was heard on the NES console.

I'm (just about) old enough to remember rushing home from school to play this game at Philip Boucher's house, sitting cross-legged in front of the TV till my feet got pins and needles. Working out how to recreate it for Sonic Pi was a lot of fun!

Getting the sounds of the NES chip

@xcapdevila
xcapdevila / gitcheats.txt
Created March 15, 2018 10:55 — forked from chrismccoy/gitcheats.txt
git cheats
# shortform git commands
alias g='git'
# get a list of all commit messages for a repo
git log --pretty=format:'%s'
# find the nearest parent branch of the current git branch
git show-branch -a | grep '\*' | grep -v `git rev-parse --abbrev-ref HEAD` | head -n1 | sed 's/.*\[\(.*\)\].*/\1/' | sed 's/[\^~].*//'
# push changes to an empty git repository for the first time
@xcapdevila
xcapdevila / Email Server (Linux, Unix, Mac).md
Created March 13, 2018 10:15 — forked from raelgc/Email Server (Linux, Unix, Mac).md
Setup a Local Only Email Server (Linux, Unix, Mac)

Setup a Local Only Email Server (Linux, Unix, Mac)

1 - Point localhost.com to your machine

Most of programs will not accept an email using just @localhost as domain. So, edit /etc/hosts file to make the domain localhost.com point to your machine, including this content to the file:

127.0.0.1 localhost.com

2 - Install Postfix

@xcapdevila
xcapdevila / YoutubeMP3Downloads.sh
Created December 20, 2017 14:36
Youtube MP3 Downloads
#You need to install first https://github.com/rg3/youtube-dl
#Edit ~/.profile
#Youtube Downloads Alias
alias youtubedlmp3="/usr/local/bin/youtube-dl -o '~/Downloads/youtube/%(title)s.%(ext)s' --no-playlist --youtube-skip-dash-manifest --format bestaudio --extract-audio --audio-format mp3 --audio-quality 0"
#usage youtubedlmp3 https://www.youtube.com/watch?v=QwqmJilXxJY
alias youtubedlmp3_noformat="/usr/local/bin/youtube-dl -o '~/Downloads/youtube/%(title)s.%(ext)s' --no-playlist --youtube-skip-dash-manifest --extract-audio --audio-format mp3 --audio-quality 0"
#usage youtubedlmp3_noformat https://www.youtube.com/watch?v=QwqmJilXxJY
@xcapdevila
xcapdevila / install.md
Created September 14, 2017 18:49 — forked from Micka33/install.md
cassandra on mac OSX

Installing Cassandra on Mac OS X

Install Homebrew

Homebrew is a great little package manager for OS X. If you haven't already, installing it is pretty easy:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@xcapdevila
xcapdevila / vanilla.js
Created September 6, 2017 11:34 — forked from rememberlenny/vanilla.js
How to post to Google docs using a jQuery ajax POST request
// url is the link for the form view page
// data is the name attribute of the field
$.ajax({
url: "https://docs.google.com/forms/d/1iqMixtVq4O0AFvYCZHbGerigi1G5Qb3XthXZX9VpNtk/formResponse",
data: { "entry.1679407376": field1},
type: "POST",
dataType: "xml",
statusCode: {
@xcapdevila
xcapdevila / stress-test.sh
Created August 24, 2017 09:05 — forked from cirocosta/stress-test.sh
naive http server stress tester using cURL
#!/bin/bash
#### Default Configuration
CONCURRENCY=4
REQUESTS=100
ADDRESS="http://localhost:8080/"
show_help() {
cat << EOF