Skip to content

Instantly share code, notes, and snippets.

View weighted_sma
//@version=4
study("Weighted SMA")
weighted_sma(price, length) =>
totalWeight = log(length)
totalMA = log(length) * price
for i = 1 to length-1
totalWeight := totalWeight + log(length - i)
currentMA = log(length - i) * sma(price, i)
totalMA := totalMA + currentMA
totalMA / totalWeight
View Main.java
package io.colyseus.example.java;
import io.colyseus.Client;
import io.colyseus.Room;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import org.jetbrains.annotations.NotNull;
public class Main {
View kotlin_get_java_generic_class.kt
import kotlin.reflect.jvm.jvmErasure
import kotlin.reflect.typeOf
class Y
class X<T>
@OptIn(ExperimentalStdlibApi::class)
inline fun <reified T> T.getGenericType(): Class<Any>? = typeOf<T>().arguments[0].type?.jvmErasure?.java as Class<Any>?
View client.ts
import { Client } from ".";
const client = new Client("ws://localhost:2560");
(async () => {
try {
const room = await client.joinOrCreate<any>("ffa");
console.log("joined successfully", room.sessionId);
View bot404.go
package main
import (
"fmt"
"net/http"
"time"
"github.com/dghubble/go-twitter/twitter"
"github.com/dghubble/oauth1"
)
View arp-spoof.go
package main
import (
"bytes"
"errors"
"fmt"
"log"
"net"
"os"
"os/signal"
View tcp_connections_exporter.go
package main
import (
"fmt"
"log"
"net/http"
"os/exec"
)
func metrics(w http.ResponseWriter, req *http.Request) {
View ping_exporter.yml
targets:
- google.com
dns:
refresh: 2m15s
nameserver: 1.1.1.1
ping:
interval: 10s
timeout: 3s
View alertmanager.yml
global:
resolve_timeout: 5m
route:
group_by: ['alertname']
group_wait: 30s
group_interval: 10m
repeat_interval: 4h
receiver: 'web.hook'
receivers:
View alert_rules.yml
groups:
- name: ping
rules:
- alert: host_down
expr: ping_loss_percent{ip_version="4",job="ping"} == 1
for: 10s
labels:
severity: page
annotations:
summary: "{{ $labels.target }} / {{ $labels.ip }}"
You can’t perform that action at this time.