Skip to content

Instantly share code, notes, and snippets.

View clsource's full-sized avatar
💻
🥷🏼

Camilo clsource

💻
🥷🏼
View GitHub Profile
@clsource
clsource / Challenge.md
Last active November 10, 2024 00:04
Error Handling Challenge

Bank Account Error Challenge

https://rm4n0s.github.io/posts/3-error-handling-challenge/

The challenge is simple to understand. Print a message to the user based on the path of function calls that produced the error, and not based on the error itself.

print three different messages based on

@clsource
clsource / update.php
Created March 2, 2024 17:26
Fetch Website from Github
<?php
/*
* This function copy $source directory and all files
* and sub directories to $destination folder
* https://gist.github.com/gserrano/4c9648ec9eb293b9377b
*/
function recursive_copy($src,$dst) {
$dir = opendir($src);
@clsource
clsource / msys2-shortcut.md
Created February 17, 2024 10:39 — forked from hollowmaster1496/msys2-shortcut.md
Open MSYS2 terminal here (mingw-w64) from right-click menu

For anyone who develops software on Windows (but needs quick access to a Linux terminal), here's a quick and easy way to get it with MSYS2.

Before starting, install "MSYS2" with default settings.

  1. From Windows search, launch 'regedit.exe'
  2. Navigate to "HKEY_CLASSES_ROOT\Directory\Background\shell"
  3. Right-click on 'shell' and select New>Key. Call this key MSYS2.
  4. Now right-click on 'MSYS2' and select New>Key. Call this key command
  5. Select command and then double-click on (Default). Set 'Value data' to "C:\msys64\msys2_shell.cmd" "-here"
@clsource
clsource / timer.go
Last active February 2, 2024 14:59
Go Exercise: Create a 5 minute Timer that displays the current remaining time in terminal
package main
import (
"fmt"
"sync/atomic"
"time"
)
type SecondsCounter struct {
count int32
@clsource
clsource / piu.phoenix.js
Last active December 26, 2023 18:10
Export Gameplay data from PIU Phoenix Website to CSV (Using TamperMonkey)
// ==UserScript==
// @name PIU.Phoenix.PlayData
// @namespace https://ninjas.cl
// @version 2023-12-25
// @description Save data from Phoenix Gameplays to local csv
// @author Camilo Castro <clsource>
// @match https://piugame.com/my_page/recently_played.php
// @match https://www.piugame.com/my_page/recently_played.php
// @icon https://www.google.com/s2/favicons?sz=64&domain=piugame.com
// @grant none
@clsource
clsource / install-elixir-debian-12.md
Last active November 28, 2023 23:42
Install Elixir in Debian 12

Hello! I am Camilo from Chile 🇨🇱. I am using a translator. I hope this information is useful.

In this article we will see how to install Elixir in Debian 12 using asdf vm.

Why Debian 12?

Debian (GNU/Linux in general) allow us to use really old hardware. I managed to revive an old Dell Latitude e430 (from 2007) and use the latest version of Erlang, Elixir and Firefox in it.

It's magical to use old machines and give them a new life, reducing the electronic waste and helping the planet.

@clsource
clsource / README.asciidoc
Created April 28, 2021 05:42
How to Extend Wren CLI with Go functions

Wren CLI is the official project for a small command line application that embeds Wren. Serves as an example implementation.

If you want to use the exact version of this tutorial. See this commit.

In this simple exercise we will export a go function and use it inside the CLI as a new class.

The function will be a simple Http server that returns a message if we go to localhost:8080

@clsource
clsource / files.py
Last active October 28, 2020 14:05
Create a good looking HTML table of files inside a directory
#!/usr/bin/env python3
"""
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2020 Camilo Castro <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@clsource
clsource / JSON.stringify.wren.js
Last active September 22, 2020 16:40
A simple JSON stringify for Wren language.
// the .js is only for syntax highlighter.
class JSON {
// Based on https://github.com/brandly/wren-json/blob/master/json.wren
static stringify(obj) {
if (obj is Num || obj is Bool || obj is Null) {
return obj.toString
}
if (obj is String) {
@clsource
clsource / README.md
Created September 11, 2020 04:18
Two Number Sum

Code Challenge: Two Number Sum

Write a function that takes in a non empty array of distinct integers and an integer representing a target sum. If any two numbers in the input array sum up to the target sum, the function should return them in an array. If no two numbers sum up to the target sum, the function should return an empty array. Assume that there will be

Tests Cases

  • Sample input 1: [3,5,-4,8,11,1,-1,6], 10