Skip to content

Instantly share code, notes, and snippets.

View catwhocode's full-sized avatar

Cat who code catwhocode

View GitHub Profile
@catwhocode
catwhocode / Extract-Email-From-Text-File.md
Last active June 16, 2023 00:38 — forked from dideler/example.md
A python script for extracting email addresses from text files.You can pass it multiple files. It prints the email addresses to stdout, one address per line.For ease of use, remove the .py extension and place it in your $PATH (e.g. /usr/local/bin/) to run it like a built-in command.
@catwhocode
catwhocode / Accessing Github Using cURL.md
Last active June 12, 2023 03:42 — forked from joyrexus/README.md
Accessing Github Using cURL

An introduction to curl using GitHub's API.

Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin

Includes HTTP-Header information in the output

@catwhocode
catwhocode / nginx.conf
Created August 25, 2022 06:03 — forked from mreschke/nginx.conf
Nginx config for multiple laravel sites based on /api/v1 url paths
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route
@catwhocode
catwhocode / createcertificate.php
Created April 10, 2022 09:02 — forked from jlainezs/createcertificate.php
Creates a certificate using OpenSSL with PHP. sing.php could be used to sign a text with the pkey generated with createCertificate. verify.java shows how to load the certificate from a resource and a verification sample of the text signed with sign.php
/**
* Creates an OpenSSL certificate
* @param $dn Array Associative array "key"=>"value"
* @param $duration int Number of days which the certificate is valid
* @throws Exception If there are any errors
* @return Array Associative array with the security elements: "cer"=>self signed certificate, "pem"=>private key, "file"=>path to the files
*
* @see http://www.php.net/manual/en/function.openssl-csr-new.php
* @author Pep Lainez
*/
@catwhocode
catwhocode / google-apps-script.md
Created April 5, 2022 08:01 — forked from labnol/google-apps-script.md
How to Learn Google Apps Script

Learning Google Apps Script

Find the best resources for learning Google Apps Script, the glue that connects all GSuite services including Gmail, Google Drive, Calendar, Google Sheets, Forms, Maps, Analytics and more.

A good place to learn more about Google Apps Script is the official documentation available at developers.google.com. Here are other Apps Script resources that will help you get up to speed.

  1. Google Apps Script Code Samples by Amit Agarwal
  2. Google Apps Script Development - Create Google Apps Script projects locally inside VS Code - video tutorial
  3. Awesome Google Scripts by Amit Agarwal
  4. Google Developer Experts - Follow Apps Scr
# [CONFIGURATION]
# Ensure WSL2 container is started and SSH is running
wsl sudo /etc/init.d/ssh start
# Ports to be forwarded
$ports = @(22) + @(6543,6544) + @(6800..6810);
# Change $addr to restrict connections to a particular interface IP
$listen_addr = '0.0.0.0';
@catwhocode
catwhocode / NaiveBayes.py
Created February 19, 2022 06:42 — forked from tuttelikz/NaiveBayes.py
Naive Bayes From Scratch in Python
#How To Implement Naive Bayes From Scratch in Python
#http://machinelearningmastery.com/naive-bayes-classifier-scratch-python/
#Dataset
#https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data
import csv
import math
import random
#Handle data
Bridging Kamar BPJS 2021 Implementasi Bridging di RSUD ALIHSAN
Ketersediaan Kamar
#Monitoring Hasil bridging Live Production
https://faskes.bpjs-kesehatan.go.id/aplicares/#/app/dashboard
#Base Url
Development: https://dvlp.bpjs-kesehatan.go.id:8888/
Production: https://new-api.bpjs-kesehatan.go.id/
#Referensi Kamar
' http://web.archive.org/web/20060527094535/http://www.nonhostile.com/howto-encode-decode-base64-vb6.asp
' http://cwestblog.com/2013/09/23/vbscript-convert-image-to-base-64/
Public Function ConvertFileToBase64(strFilePath As String) As String
Const UseBinaryStreamType = 1
Dim streamInput: Set streamInput = CreateObject("ADODB.Stream")
Dim xmlDoc: Set xmlDoc = CreateObject("Microsoft.XMLDOM")
Dim xmlElem: Set xmlElem = xmlDoc.createElement("tmp")
@catwhocode
catwhocode / perkalian_matriks.php
Last active December 16, 2020 07:15 — forked from f2face/perkalian_matriks.php
[PHP] Fungsi Perkalian Matriks
<?php
/* Fungsi perkalian matriks
* @f2face - 2013
*/
function kalikan_matriks($matriks_a, $matriks_b) {
$hasil = array();
for ($i = 0; $i < sizeof($matriks_a); $i++) {
for ($j = 0; $j < sizeof($matriks_b[0]); $j++) {
$temp = 0;