Skip to content

Instantly share code, notes, and snippets.

View kidandcat's full-sized avatar
☀️
Looking for the place of sunrise

Hairok kidandcat

☀️
Looking for the place of sunrise
View GitHub Profile
eval "$(oh-my-posh init bash)"
alias lss='exa --long --header --git'
@kidandcat
kidandcat / main.go
Created October 27, 2020 10:15 — forked from guinso/main.go
Sample SMTP with attachment
package main
import (
"crypto/tls"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
"net/smtp"
"strings"
const myMembers = data.results[0].members;
let fieldsInserted = ["first_name", "party", "state", "seniority", "votes_with_party_pct"];
let tBody = document.getElementById("houseData");
let link = ["url"]; //he creado otra variable con el atributo ''url'' que se encuentra en el JS, pero no se en que momento colocarlo ni que poner.
for (let i=0; i< myMembers.length; i++) {
let newTr = document.createElement("tr");
for (let j=0; j< fieldsInserted.length; j++) {
let dataInserted = fieldsInserted[j];
let newTd = document.createElement("td");
newTd.innerHTML = myMembers[i][dataInserted]
const member = data.results.members[j]
function crearCelda(memberData, campo){ // necesitamos recibir memberData para poder coger el valor de la propiedad
// Repetir este bloque por cada celda de informacion que queremos meter en la fila
let td = document.createElement("td");
// añadimos informacion del miembro a la celda (td -> table data)
td.innerHTML = memberData[campo] // Cogemos la propiedad que haya en la variable campo
// añadimos esa celda a la fila que tenemos (tr -> table row)
return td //devolvemos el td
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
@kidandcat
kidandcat / server.nim
Created April 15, 2019 14:40
Server in Nim
import asynchttpserver, asyncdispatch, json
var server = newAsyncHttpServer()
proc handler(req: Request) {.async.} =
case req.url.path:
of "/hello-world":
let msg = %* {"message": "Hello World"}
let headers = newHttpHeaders([
("Content-Type","application/json"),

Keybase proof

I hereby claim:

  • I am kidandcat on github.
  • I am kidandcat (https://keybase.io/kidandcat) on keybase.
  • I have a public key ASD98swS2LH5OPYFa-Ym7jU1FRgniyQU0KGgiRsDzo4Hhwo

To claim this, I am signing this object:

import Control.Monad (forM_, when)
import Control.Monad.ST
import Data.Array.ST
import Data.Array.Unboxed
import System.Environment
sieve :: Int -> UArray Int Bool
sieve n = runSTUArray $ do
let m = (n-1) `div` 2
r = floor . sqrt $ fromIntegral n
function uuidv4() {
return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c =>
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
)
}
package main
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"log"
"os"