Skip to content

Instantly share code, notes, and snippets.

@auycro
auycro / headers.py
Last active October 31, 2023 05:51
Run http.server with headers (For GoDot's web local test)
import sys
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Cross-Origin-Opener-Policy','same-origin')
self.send_header('Cross-Origin-Embedder-Policy','require-corp')
SimpleHTTPRequestHandler.end_headers(self)
@auycro
auycro / bash-memo.sh
Last active April 25, 2022 09:29
bash memo
#!/bin/bash
## TEXT MANIPULATION ##
### CUT ###
# print the fields from second fields to last.
echo 'a\tb\tc' | cut -d$'\t' -f 2-
# b c
@auycro
auycro / helm_release.tf
Created April 17, 2022 13:49
Helm Release example
resource "helm_release" "mysql-db" {
name = "mysql-db"
repository = "https://charts.bitnami.com/bitnami"
chart = "mysql"
values = [
file("${path.module}/helmfiles/mysql-values.yaml")
]
}
@auycro
auycro / rfc_1.md
Last active December 7, 2022 19:31
RFC templates

(this is an old example that illustrates how I introduced a a team to the process of RFCs, my understanding of how to deploy this process well has evolved since then)

RFC on RFCs

  • Main Author: @buritica
  • Backers: n/a

1 Summary

@auycro
auycro / App.svelte
Last active February 13, 2022 04:15
Svelte with Cytoscape Example
<!--
---Created by Gumpanat Keardkeawfa on 2022Feb13.---
---Copyright © 2022 Auycro. All rights reserved.---
-->
<script>
import cytoscape from 'cytoscape'
import { onMount } from 'svelte';
const endpoint = "https://js.cytoscape.org/demos/grid-layout/data.json";
let data = [];
@auycro
auycro / golang-google-vision-api-detectText.go
Created February 4, 2022 03:14
golang google-vision-api detectText
// Sample vision-quickstart uses the Google Cloud Vision API to label an image.
// https://cloud.google.com/vision/docs/ocr
package main
import (
"context"
"fmt"
"log"
"os"
@auycro
auycro / check-lat-lng.gs
Created July 15, 2021 08:10
check lat lng appscript
function printLatLng(input){
var r = Maps.newGeocoder().geocode(input);
for (var i = 0; i < r.results.length; i++) {
var res = r.results[i];
console.log(input, res.geometry.location.lat + ", " + res.geometry.location.lng);
}
}
function myFunction() {
/** @OnlyCurrentDoc */
@auycro
auycro / Android-Build-Cheatsheet.md
Last active February 5, 2021 10:27
android-fix-build-log

Try build with gradlew

# ./gradlew build --stacktrace

Get this Error

A problem occurred configuring project ':app'.
@auycro
auycro / Program.cs
Last active February 3, 2021 14:45
Create Readonly Dict from Langext map
using System;
using System.Collections.Generic;
using System.Linq;
using LanguageExt;
using static LanguageExt.Prelude;
namespace lang_ext
{
class Program
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var test_data = Init();
test_data.ForEach((x)=>{
if (IsBothConditions(x)){
System.Console.WriteLine("baz");