Skip to content

Instantly share code, notes, and snippets.

@CamiloGarciaLaRotta
CamiloGarciaLaRotta / WP_CALENDAR_CONDITIONAL_RENDERING.php
Created November 26, 2023 00:26
Snippets to add conditional rendering for custom attrs: {has_foo}print foo{/has_foo}
// see https://wp-events-plugin.com/documentation/conditional-placeholders/
// for the conditional funcs that we have out of the box
// see https://wp-events-plugin.com/tutorials/creating-conditional-placeholders-for-events/
// for how to introduce conditional funcs for custom attributes
// the docs explain what each each variable means
function em_event_output_condition_filter($replacement, $condition, $match, $EM_Event){
// Checks for has_FOO conditional
if(is_object($EM_Event) && preg_match('/^has_(FOO)$/', $condition, $matches)){
if(array_key_exists($matches[1], $EM_Event->event_attributes) && !empty($EM_Event->event_attributes[$matches[1]]) ){
@CamiloGarciaLaRotta
CamiloGarciaLaRotta / JIT.md
Last active February 18, 2021 14:43
Git under the hood

commit

Made of:

  • a tree: PWD state, not a diff, but rather an efficient representation of the full state
  • a comment
  • commiter info
  • hash of parent commit Process:
  • if file didn't change: add compressed filename (hash) to the snapshot
  • if file changed: compress it, store it in .git/objects, add filename hash to snapshot
Attribute Based Access Control
Access Control paradigm in which access rights are granted through policies which combine attributes together.
Subject attributes: describe the user attempting the action. age, department, position
Action attributes: describe the action being attempted. read, write, delete
Object attributes: describe the object/resource targeted. type, directory
Environment attributes: describe dynamic aspects of the scenario. time, location
Architecture:
@CamiloGarciaLaRotta
CamiloGarciaLaRotta / ideas.txt
Created April 19, 2019 00:20
Project ideas
Port https://github.com/dbader/schedule to Go
========================================================
grass or the grass is greener on the other side:
web forum following the structure of stackoverflow.
with the twist that rather than posting questions to get answers,
users post problems they solved and users can comment with alternative solutions.
problem and solution statement should be devoid of specific details of the implementation,
@CamiloGarciaLaRotta
CamiloGarciaLaRotta / settings.json
Created April 2, 2019 18:06
MOE VSCode settings
{
"python.pythonPath": "${workspaceFolder}/.venv/bin/python",
"python.autoComplete.addBrackets": true,
"python.unitTest.unittestEnabled": true,
"python.unitTest.pyTestEnabled": false,
"python.unitTest.nosetestsEnabled": false,
"python.linting.pylintArgs": [
"--ignored-classes=Resource",
"--max-line-length=135"
],
@CamiloGarciaLaRotta
CamiloGarciaLaRotta / Tack Brainstorming
Last active April 4, 2019 00:42
Design Thinking results for the Tack concept
The concept of a job application tracking helper came about for the semester project for ECSE 428 at McGill University.
The purpose of the class being applying learned SW Engineering methodologies and CS concepts to design and implement a product.
Because groups were made of 15 students, the basic idea of a helped got expanded to accomodate extra features.
We ended up with a web app (with auth & inhouse job applications) and a Chrome Extension helper.
There was no rigorous process to understand completely the issue trying to be solved.
But I believe we hit not so far from a good target.
Hence, I want to go back to understanding the users & framing the problems they encounter while job hunting.
I want to then strip down the existent system from any unecessary components, in order to have just a
standalone (no server required) web extension which addresses some of thecore problems of job hunting.
@CamiloGarciaLaRotta
CamiloGarciaLaRotta / maven-plugin-testing-rant
Created September 21, 2018 06:12
On testing Maven plugins and other deamons
Recall Maven strictly follows the lifecycles: validate, compile, test, package, verify, install, deploy.
Attempting to switch the order of any of the lifecycles can only be done through hacky approaches
(for example, the way we override the default maven-compiler by setting the compile lifecycle phase
of the compiler to "None" and we push the compilation to the validation phase)
Here's the resume of my adventures testing Maven plugins:
Maven-verifier: can execute arbitrary lifecycles on a dummy project. Hence can assert on its artifacts, on stdout/err and logfiles
issue: the dummy project requires the plugin under test to already be available in the local artifact repository.
but due to the lifecycle order, the integration tests (verify phase) are run before the artifact is stored in the local repo (install)
table.Properties Access table properties
t{i} Access by index
t(2:end,[1, 5]) From t make new table w/ specific cols/rows
{'var1','var2'} Also valid form to access cols
t.newVar = Add new col to table
t = datetime(timestamp) Create datetime table
hour(t), day(t), ...
t{[i j],'colName'} = {'';''} Modify values in position i,j of column in table
when sorting a list that has a relationship with another list,
+----+---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| # | Vulnerability | Explanation | How To Avoid |
+----+---------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------
Kill Chain example
Reconnaisance:
Sniffing: tcpdump, netcat, nmap, sqlmap + wireshark
Spoofing: Bettercap, arpspoof
Proxy: BurpSuite
Attack: MSF, SET
Choose desired vulnerability
Choose desired payload
Deliver bundle