Skip to content

Instantly share code, notes, and snippets.

Ronie Uliana ruliana

Block or report user

Report or block ruliana

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ruliana
ruliana / print_keyboard_layout.sh
Created Sep 15, 2019
Print the keyboard layout in pdf
View print_keyboard_layout.sh
xkbprint -label name -o keyboard-layout.ps $DISPLAY; ps2pdf keyboard-layout.ps
@ruliana
ruliana / maze01.scm
Created Sep 11, 2019
Mazes for Programmers in Guile Scheme. Binary Tree and Sidewinder algorithms implemented.
View maze01.scm
(use-modules (oop goops)
(srfi srfi-1) ;; sane lists
(srfi srfi-26) ;; cut
(srfi srfi-42) ;; list comprehension
(srfi srfi-69) ;; hash-table
(srfi srfi-88)) ;; keywords
;; Upper lambda as an alias for "cut"
(define-syntax Λ (identifier-syntax cut))
@ruliana
ruliana / sane-extensions.scm
Last active Sep 10, 2019
Sprinkling some syntax sugar on Guile Scheme to make it more pratical. Let's say "better defaults" for my personal taste :)
View sane-extensions.scm
(use-modules (srfi srfi-1) ;; list operations
(srfi srfi-11) ;; let-values
(srfi srfi-41) ;; streams
(srfi srfi-42) ;; list comprehension
(srfi srfi-88) ;; keyword as "this:", not only "#:this"
(oop goops) ;; function overloading ("OOP" is _not_ the main point)
((ice-9 format) #:prefix fmt.))
(define-syntax def (identifier-syntax define-method))
@ruliana
ruliana / .xmodmap
Created Sep 7, 2019
My xmodmap with brazilian portuguese mapping and mathematical symbols (with more common greek letters)
View .xmodmap
keycode 8 =
keycode 9 = Caps_Lock NoSymbol Caps_Lock
keycode 10 = 1 exclam 1 exclam onesuperior exclamdown
keycode 11 = 2 at 2 at twosuperior onehalf
keycode 12 = 3 numbersign 3 numbersign threesuperior threequarters
keycode 13 = 4 dollar 4 dollar sterling onequarter
keycode 14 = 5 percent 5 percent cent U2030
keycode 15 = 6 dead_diaeresis 6 asciicircum notsign diaeresis
keycode 16 = 7 ampersand 7 ampersand dead_belowdot dead_abovedot
keycode 17 = 8 asterisk 8 asterisk dead_ogonek dead_horn
@ruliana
ruliana / pre-conditions.ss
Created Aug 28, 2019
Function selection based on pre-conditions in Chez Scheme (very nice exercise using call/cc)
View pre-conditions.ss
(define (pre-condition assertion) 'noop)
(define (try . procs)
(let loop ([procs procs])
(define proc (car procs))
(define (make-pre-condition k)
(lambda (assertion)
(when (not assertion)
(k (lambda () (loop (cdr procs)))))))
(define (exec k)
@ruliana
ruliana / wip.ss
Created Aug 9, 2019
Fighting scheme macros
View wip.ss
(define empty? null?)
(define empty '())
(define first car)
(define rest cdr)
(define (split2 item lst)
(let loop ([remaining lst]
[left empty])
(cond [(empty? remaining) (values (reverse left) empty)]
[(equal? item (first remaining)) (values (reverse left) (rest remaining))]
@ruliana
ruliana / power-let.ss
Created Aug 6, 2019
Scheme "power-let" exploring
View power-let.ss
(trace-define-syntax power-let
(syntax-rules (<-)
[(_ (v <- expr) rest ...) (let [(v expr)] (power-let rest ...))]
[(_ body0 body* ...) (begin body0 body* ...)]))
(define-syntax def
(syntax-rules ()
((_ (name args ...) body ...)
(define (name args ...)
(power-let body ...)))))
@ruliana
ruliana / word_game.js
Last active Aug 2, 2019
Making the "Preposition Game" a little better (still not there)
View word_game.js
function wordGame(words) {
let clicks = 0;
let correct = 0;
function updateScore() {
let score = document.querySelectorAll('.word-game-score-panel')[0];
if (clicks == 0) {
score.innerHTML = "The Preposition Game<br>Accuracy: 0%";
} else {
let accuracy = Math.round(correct / clicks * 100);
@ruliana
ruliana / preposition_game.js
Created Aug 1, 2019
Let's guess what's the correct preposition (on, at, in). Create as bookmarket with it :)
View preposition_game.js
function printSolution(element) {
let answer = element.getAttribute("data-answer");
let selectedOptions = Array.from(element.selectedOptions).map(e => e.text);
if (selectedOptions.includes(answer)) {
element.style.border = "2px solid green";
} else {
element.style.border = "2px solid red";
}
}
let prepositions = ["", "on", "at", "in"];
@ruliana
ruliana / svc_predict_vs_predict_proba.py
Created Nov 9, 2018
First part of predict vs predict_proba for SVC in Scikit-Learn
View svc_predict_vs_predict_proba.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from itertools import count
import re
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.cross_validation import train_test_split
from sklearn.svm import SVC
You can’t perform that action at this time.