Skip to content

Instantly share code, notes, and snippets.

@whittlem
whittlem / relativeStrengthIndex.py
Last active May 2, 2024 21:49
Trading using Python — Relative Strength Index (RSI)
# data: dictionary { 'dd/mm/yyy': price, 'dd/mm/yyyy': price, ... }
def relativeStrengthIndex(data, num):
if not isinstance(data, dict):
raise Exception('Dictionary input expected')
if not isinstance(num, int):
raise Exception('Integer input expected')
@BlakeStevenson
BlakeStevenson / texas-dps.js
Last active May 2, 2024 21:47
Create an appointment at the Texas DPS at the closest location, soonest time, programatically.
const axios = require('axios');
async function getLocations() {
const locationsData = await axios.post("https://publicapi.txdpsscheduler.com/api/AvailableLocation", {
"TypeId": 71,
"ZipCode": "10001",
"CityName": "",
"PreferredDay": 0
});
return locationsData.data;
}
@jmilet
jmilet / websocket_binary_data_go.md
Last active May 2, 2024 21:36
Example of WebSocket binary data in Go

The server

package main

import (
	"bytes"
	"encoding/binary"
	"flag"
	"fmt"
@mikilian
mikilian / CMakeLists.txt
Created June 29, 2021 21:27
Modern C++ development with alpine linux, cmake, clang inside a docker container
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
cmake_minimum_required(VERSION 3.18)
set(APP_NAME "example-app")
project("${APP_NAME}")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++20 -Wno-multichar")
.org $8000
.org $ff00
XAML = $24 ; Last "opened" location Low
XAMH = $25 ; Last "opened" location High
STL = $26 ; Store address Low
STH = $27 ; Store address High
L = $28 ; Hex value parsing Low
H = $29 ; Hex value parsing High
YSAV = $2A ; Used to see if hex value is given
@fideliocc
fideliocc / getDashboardUrl.js
Last active May 2, 2024 20:52
Lambda function hooked to API Gateway GET endpoint to attend: role assuming, registering for QuickSight and dashboard URL resolving for web app embedding feature
'use strict'
// IMPORTANT: Replace environment variables with your current values
const aws = require('aws-sdk')
aws.config.region = process.env.REGION
const sts = new aws.STS({apiVersion: '2011-06-15'})
module.exports.handler = (event, context, callback) => {
console.log('User email', event.queryStringParameters.email)
@darkr4y
darkr4y / httpsrv.py
Last active May 2, 2024 20:42
python simple http server with upload & download
#!/usr/bin/env python
"""Extend Python's built in HTTP server to save files
curl or wget can be used to send files with options similar to the following
curl -X PUT --upload-file somefile.txt http://localhost:8000
wget -O- --method=PUT --body-file=somefile.txt http://localhost:8000/somefile.txt
__Note__: curl automatically appends the filename onto the end of the URL so
@8bitniksis
8bitniksis / Transparency
Created May 2, 2024 20:28
Shader which fixed issues with standard object if apply fade render query
Shader "Custom/Transparency "
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1)
}
SubShader
{
CGPROGRAM
# -*- coding: utf-8 -*-
"""
Introducción a los Algoritmos Geneticos
Autor: Guillermo Izquierdo
Este código es para fines educativos exclusivamente.
"""
geneSet = 'abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ '
target = 'Hola Mundo'
@insdavm
insdavm / WireGuard-site-to-site.md
Last active May 2, 2024 20:10
Accessing a subnet that is behind a WireGuard client using a site-to-site setup

WireGuard Site-to-Site

Accessing a subnet that is behind a WireGuard client using a site-to-site setup

Problem Summary

We want to access a local subnet remotely, but it is behind a NAT firewall and we can't setup port forwarding. Outgoing connections work, but all incoming connections get DROPPED by the ISP's routing policy.

Solution Summary