Skip to content

Instantly share code, notes, and snippets.

View ryukinix's full-sized avatar
☢️
IN RESEARCH

Manoel V. Machado ryukinix

☢️
IN RESEARCH
View GitHub Profile
@ryukinix
ryukinix / kmp-substring-search.lisp
Created July 13, 2017 16:01
KMP substring problem implementation on Common Lisp
;; kmp-fp: Substring Search @ HackerRank
;; Date: Thu 13 Jul 2017 08:48:40 AM -03
;; Manoel Vilela
;; NOTE: I'm programming in Common Lisp or in LOOP-MACRO?
(defun make-prefix-table (pattern length)
"Get the shift prefix array table to use on KMP
algorithm. This value is used to shift string comparison
on the next evaluation after a mismatch"
@ryukinix
ryukinix / PKGBUILD
Last active July 20, 2017 13:37
A new version of PKGBUILD for python-imapclient to avoid the mock==1.3.0 legacy dependency error on Arch Linux
# Maintainer: Carol Alexandru shapeshifter@archlinux.us
# Fixed by Manoel Vilela <manoel_vilela@engineer.com>
pkgname=python-imapclient
pkgver=1.0.2
pkgrel=1
pkgdesc="An easy-to-use, Pythonic and complete IMAP client library with no dependencies outside the Python standard library"
arch=('any')
url="http://imapclient.freshfoo.com/"
license=('BSD')
depends=('python' 'python-backports.ssl')
@ryukinix
ryukinix / fmota-path-statistics.cpp
Last active July 24, 2017 20:37
This is a wizardy solution from the last problem of Week of Code 34 which I found, author nickname: @FMota0
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
#define left fdhfkladhfl
#define right fdflhdlfjha
#define tm fadfdhajl
using namespace std;
const int maxn = 55555;
struct bset{
vector<long long> info;
bset(){}
@ryukinix
ryukinix / hooks.el
Last active July 30, 2017 01:42
Setup C/C++ compile command and gdb
(defvar gud-gud-gdb-history nil)
(defun setup-c-and-cpp-compiler-with-gdb ()
(interactive)
"Generate strings for 'compile and 'gud-gdb commands on C/C++ mode"
(define-key (current-local-map) "\C-c\C-c" 'compile)
(define-key (current-local-map) [M-f9] 'gud-gdb)
(when buffer-file-name
(let* ((file (file-name-nondirectory buffer-file-name))
(file-basename (file-name-sans-extension file))
(extension (if (eq system-type 'windows-nt) "exe" "out")))
@ryukinix
ryukinix / mano.el
Last active August 3, 2017 07:34
A collection of useful macros in Emacs Lisp
;;; mano.el -- useful macros made by me, Manoel
;; Copyright © 2017 Manoel Vilela
;;
;; Author: Manoel Vilela <manoel_vilela@engineer.com>
;; URL: https://github.com/ryukinix/dotfiles
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
@ryukinix
ryukinix / test.py
Created August 4, 2017 01:43
Minha solução para um problema de matemática durante uma entrevista de emprego (Brick Abode)
# coding: utf-8
# Triangle
# Triangle: Determine whether a triangle can be built from a given set of edges
# A zero-indexed array A consisting of N integers is given. A triplet (P, Q,
# R) is triangular if 0 ≤ P < Q < R < N and:
#
# A[P] + A[Q] > A[R], <=> A[P] <= A[P] + A[Q]
# A[Q] + A[R] > A[P], <=> A[P] <= A[Q] + A[R]
# A[R] + A[P] > A[Q]. <=> A[R] <= A[P] + A[R]
@ryukinix
ryukinix / warsaw.sh
Created August 8, 2017 07:57
An OpenRC script for the Brazillian Security Module Warsaw from GAS Technology
#!/usr/bin/openrc-run
### BEGIN INIT INFO
# Provides: warsaw
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Handles Warsaw - core
# Description: Warsaw Technology - core
# Developed by GAS Tecnologia<info@gastecnologia.com.br>
@ryukinix
ryukinix / pipeline.py
Last active November 23, 2017 20:58
A hacky implementation of pipelines in Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2017 Manoel Vilela
#
# @project: Pipelines in Python
# @author: Manoel Vilela
# @email: manoel_vilela@engineer.com
#
@ryukinix
ryukinix / matrix.c
Last active August 23, 2017 19:09
Diferenças entres tipos de alocação dinâmica de matrizes em C
/**
* Copyright 2017 Manoel Vilela
*
* Referências da Aula_0 e Aula_1.
*/
// Nós temos duas maneiras de lidar com matrizes
// e alocação dinâmica.
// Uma matriz pode ser representada como um conjunto de n
@ryukinix
ryukinix / hello.hs
Last active October 20, 2017 08:07
Haskell hello world assembly generated with -S option
main = print "Be cancer"