Skip to content

Instantly share code, notes, and snippets.

View jpcofr's full-sized avatar

Juan Pablo Contreras Franco jpcofr

  • Gothenburg, Sweden
View GitHub Profile
@jpcofr
jpcofr / homework.cls
Last active October 8, 2015 15:38 — forked from jhwilson/jhwhw.cls
Document class for Homework assignments
%=====================================================================
% jhwhw.cls
% Provide jhwhw.cls class
%=====================================================================
%=====================================================================
% Identification
%=====================================================================
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{homework}[2015/02/11 Homework Class]
@jpcofr
jpcofr / hosts
Last active February 2, 2017 19:05
Hosts file to prevent computer connecting to undesired sites
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#
# See below for acknowledgements.
# Please forward any additions, corrections or comments by email to
# [email protected]
@jpcofr
jpcofr / pre-render.js
Created August 2, 2017 09:13 — forked from mef/pre-render.js
proof-of-concept pre-rendering d3.js svgs on the server using node.js and jsdom module.
// pre-render d3 charts at server side
var d3 = require('d3')
, jsdom = require('jsdom')
, fs = require('fs')
, htmlStub = '<html><head></head><body><div id="dataviz-container"></div><script src="js/d3.v3.min.js"></script></body></html>'
jsdom.env({
features : { QuerySelector : true }
, html : htmlStub
, done : function(errors, window) {
@jpcofr
jpcofr / create_nodejs_server.js
Created August 2, 2017 12:41
Create a nodejs server
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {
'Content-Type': 'text/plain'
});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
@jpcofr
jpcofr / download_gists.js
Created August 2, 2017 12:45 — forked from thomastraum/download_gists.js
Gist to download all your gists
var request = require('request')
, path = require('path')
, fs = require('fs')
, url = "https://api.github.com/users/thomastraum/gists"
, savepath = './gists';
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
@jpcofr
jpcofr / d3_svg_server_rendering.js
Created August 2, 2017 14:36
Renders an svg circle at server side
var fs = require('fs');
var d3 = require('d3')
require('jsdom-global')()
var body = document.querySelector('body')
d3.select(body)
.append('svg:svg')
.attr('xmlns', 'http://www.w3.org/2000/svg')
.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink')
@jpcofr
jpcofr / d3-server.js
Last active August 2, 2017 15:21 — forked from caged/d3-server.js
Directly render and serve d3 visualizations from a nodejs server.
// Start `node d3-server.js`
// Then visit http://localhost:1337/
//
var d3 = require('d3'),
http = require('http'),
jsdom = require('jsdom/lib/old-api'),
fs = require('fs'),
xmldom = require('xmldom');
http.createServer(function (req, res) {
@jpcofr
jpcofr / map_to_ctrl.reg
Last active March 25, 2023 20:09
Windows Registry File to Remap Caps Lock to Control Key
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,00,00,3a,00,00,00,00,00
0000 0000 0000 0000 0200 0000 1d00 3a00 0000 0000
@jpcofr
jpcofr / CMakeLists.txt
Created March 25, 2023 20:02
CMakeLists.txt for Building a raylib based Project on macOS 13.2.1
cmake_minimum_required(VERSION 3.25)
set(CMAKE_CXX_STANDARD 17)
project(my_project)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set(RAYLIB_LIB raylib/src/libraylib.a)
set(RAYLIB_INCLUDE raylib/src)
@jpcofr
jpcofr / clean_prj.sh
Created April 6, 2023 04:55
Cleans make/cmake project directory
#!/bin/bash
# This script cleans the project directory.
# The CLIs are compatible with Linux and Mac OS X.
## Function: clean_project
function clean_project() {
# Delete CMake generated files except CMakeLists.txt
find . -iwholename '*cmake*' -not -name CMakeLists.txt -delete
# Delete makefile