Skip to content

Instantly share code, notes, and snippets.

View gabrielcsapo's full-sized avatar
💻
In the matrix

Gabriel Csapo gabrielcsapo

💻
In the matrix
View GitHub Profile
@joeycastillo
joeycastillo / Focus.cpp
Created June 20, 2022 22:37
A simple Focus-based app for tracking progress on projects
#include "Focus.h"
#include "Arduino.h"
#include <algorithm>
Task::Task() {
}
View::View(Rect rect) {
this->frame = rect;
this->window.reset();
@zaiste
zaiste / rst_to_md.sh
Created February 5, 2017 18:54
Convert RST to Markdown using Pandoc
FILES=*.rst
for f in $FILES
do
filename="${f%.*}"
echo "Converting $f to $filename.md"
`pandoc $f -f rst -t markdown -o $filename.md`
done
@victorferreira
victorferreira / Making it Swift.swift
Last active October 27, 2020 06:52
Updating SQLite Tutorial code to Swift 3. See the tutorial at: https://www.raywenderlich.com/123579/sqlite-tutorial-swift
//: Back to [The C API](@previous)
import SQLite
import Foundation
import PlaygroundSupport
destroyPart2Database()
//: # Making it Swift
# coding: utf-8
# Imports
import os
import cPickle
import numpy as np
import theano
import theano.tensor as T
@davidcalhoun
davidcalhoun / pascals-triangle.js
Last active December 14, 2017 17:38
pascal's triangle in javascript
function pt(lineLimit, lines) {
// Seed the first value.
if(!lines || lines.length === 0) return pt(lineLimit, [[1]]);
var newLine = [];
var lastLine = lines[lines.length - 1];
// Fill out inner values
for(var i=1, len=lastLine.length; i<len; i++) {
newLine.push(lastLine[i - 1] + lastLine[i]);
@geoffyuen
geoffyuen / dot_clean recursively
Created September 7, 2013 01:24
Even though it's documented as recursive, dot_clean does not work recursively. Do this instead.
(find . -type d | xargs dot_clean -m)
@lsauer
lsauer / gist:5196979
Last active June 7, 2023 08:12
JavaScript List of selected MIME types (JSON)
//lsauer.com , lo sauer 2013
//JavaScript List of selected MIME types
//A comprehensive MIME List is available here: https://gist.github.com/lsauer/2838503
var mimeTypes =
{
'a' : 'application/octet-stream',
'ai' : 'application/postscript',
'aif' : 'audio/x-aiff',
'aifc' : 'audio/x-aiff',
'aiff' : 'audio/x-aiff',
@carlosmcevilly
carlosmcevilly / gist:2221249
Created March 27, 2012 22:55
fix git commit with wrong email address in git config, before pushing
If:
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config user.name "Your Name"
@ded
ded / directory-size.js
Created March 5, 2011 10:16
a simple node script to determine the size of any directory on a file system
/**
* usage
* DIR='public/js' node directory-size.js
* => "size of public/js is: 12,432
*/
var fs = require('fs'),
_ = require('./underscore'); // requires underscore for _.flatten()
function format(n) {
// All elements which match this will be syntax highlighted.
var selector = 'code';
var keywords = ('var function if else for while break switch case do new '
+'continue delete return this true false throw catch typeof').split(' ');
// Syntax definition
// The key becomes the class name of the <span>
// around the matched block of code.
var syntax = {