Skip to content

Instantly share code, notes, and snippets.

View sergio-bobillier's full-sized avatar

Sergio Bobillier sergio-bobillier

View GitHub Profile
@sergio-bobillier
sergio-bobillier / settings.json
Last active March 15, 2024 16:29
Personal VS-Code settings
{
"editor.renderWhitespace": "boundary",
"breadcrumbs.enabled": true,
"workbench.colorTheme": "One Dark Pro",
"editor.tabSize": 2,
"editor.rulers": [
80,
100,
120
],
@sergio-bobillier
sergio-bobillier / gate-keepers.cql
Last active April 8, 2018 05:47
A neo4j database of all the Lineage 2 Gatekeepers with costs. (WIP)
CREATE (:Town {name: 'Heine'})
CREATE (:Town {name: 'Town of Giran'})
CREATE (:Town {name: 'Town of Oren'})
CREATE (:Town {name: 'Town of Dion'})
CREATE (:Town {name: 'Town of Aden'})
CREATE (:Town {name: 'Town of Goddard'})
CREATE (:Town {name: 'Town of Rune'})
CREATE (:Town {name: 'Town of Schuttgart'})
CREATE (:Town {name: 'Town of Gludio'})
CREATE (:Town {name: 'Talking Island Village'})
@sergio-bobillier
sergio-bobillier / blocky.rb
Created January 2, 2018 15:22
Stripped-down implementation of a blockchain
require 'date'
require 'digest'
class Block
attr_reader :data, :hash, :parent, :author, :created_at
def initialize(data:, parent:, author:)
raise ArgumentError.new '`data` should respond to `to_s`' unless data.respond_to?(:to_s)
raise ArgumentError.new '`author` should respond to `to_s`' unless author.respond_to?(:to_s)
@sergio-bobillier
sergio-bobillier / blocky.rb
Created January 2, 2018 15:22
Stripped-down implementation of a blockchain
require 'date'
require 'digest'
class Block
attr_reader :data, :hash, :parent, :author, :created_at
def initialize(data:, parent:, author:)
raise ArgumentError.new '`data` should respond to `to_s`' unless data.respond_to?(:to_s)
raise ArgumentError.new '`author` should respond to `to_s`' unless author.respond_to?(:to_s)
@sergio-bobillier
sergio-bobillier / email-library.diff
Last active January 17, 2017 22:16
Patch to fix a remote code execution vulnerability in CodeIgniter 2.x email library (backported from CodeIgniter 3.1.3)
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index ca9cd1e..9310844 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -1528,6 +1528,33 @@ class CI_Email {
// --------------------------------------------------------------------
/**
+ * Validate email for shell
+ *
@sergio-bobillier
sergio-bobillier / easycrypt.bash
Created March 6, 2016 17:49
Two easy to remember bash functions for your .bashrc file used to cipher and decipher files with the AES 256 cipher algorithm. (Uses OpenSSL).
function crypt {
openssl enc -e -aes256 -a -in $1 -out $2
}
function decrypt {
openssl enc -d -aes256 -a -in $1 -out $2
}
@sergio-bobillier
sergio-bobillier / check-services.sh
Created October 17, 2015 12:40
A little script to check the status of system services with a nice colored output.
#!/bin/bash
# Checks if services are up by counting the number of processes.
function check_service {
PROCS=$(ps ax | grep "$1" | wc -l)
if [ $PROCS -gt 1 ] ; then
echo -e "[\e[1m\e[32mUP\e[0m]"
else
echo -e "[\e[1m\e[31mDOWN\e[0m]"
@sergio-bobillier
sergio-bobillier / luhn.php
Last active December 16, 2015 04:14
Clean implementation of the Luhn algorithm in PHP
<?php
/** Validates a credit card number using the Luhn algorithm.
* http://en.wikipedia.org/wiki/Luhn_algorithm
*
* @param string $card_number The card number (without spaces, dots, or other
* special characters, only the numbers).
*
* @return boolean True if the number is valid, false otherwise.
*