Skip to content

Instantly share code, notes, and snippets.

@ninedraft
ninedraft / README.md
Last active July 6, 2024 05:58
Python udp broadcast client server example.

Python udp broadcast client-server example

⚠️ ❗ ATTENTION ❗ ⚠️

This gist is deprecated and will not be edited in the future. Consider visit ninedraft/python-udp repo. It will not be deleted, however.

⚠️ ❗ ATTENTION ❗ ⚠️

% SN - массив сигнала
% window - размер окна сглаживания
window = 5;
if(mod(window,2)==0)
window=window+1;
end
%размах окна влево и вправо от текущей позиции
hw=(window-1)/2;
@ninedraft
ninedraft / playground.rs
Created May 29, 2017 08:51 — forked from anonymous/playground.rs
Shared via Rust Playground
use std::convert::AsMut;
fn clone_into_array<A, T>(slice: &[T]) -> Option<A>
where A: Sized + Default + AsMut<[T]>,
T: Clone
{
let mut arr = Default::default();
{
let mut_arr = <A as AsMut<[T]>>::as_mut(&mut arr);
let arr_len = mut_arr.len();

Keybase proof

I hereby claim:

  • I am ninedraft on github.
  • I am twentydraft (https://keybase.io/twentydraft) on keybase.
  • I have a public key ASCLrd__pvnCe7feddMjFKWT4zgaGsrlu4EghQ1y_8JQPgo

To claim this, I am signing this object:

@ninedraft
ninedraft / debug.go
Created March 20, 2018 12:18
Logrus debug handler
package util
import (
"fmt"
"path"
"runtime"
"strings"
"github.com/sirupsen/logrus"
)
import re
import shlex
import pandas as pd
import time
import random
import os, sys
random.seed(time.time())
path = "/tmp/logeniue"
package kube
import (
"encoding/json"
"io"
"github.com/ericchiang/k8s"
metav1 "github.com/ericchiang/k8s/apis/meta/v1"
"github.com/mitchellh/mapstructure"
"github.com/thoas/go-funk"
schema:
- name: embark
commands:
build:
status: true
method: go build -v -o embark ./cmd/embark/
test:
status: true
watcher:
paths:
import (
gpflag "github.com/octago/sflags/gen/gpflag"
cobra "github.com/spf13/cobra"
)
type Flags struct {
// flag definitions here
// https://github.com/octago/sflags#flags-based-on-structures------
}
@ninedraft
ninedraft / http_client_with_proxy.go
Last active December 27, 2018 16:26
simple factory to build http.Client over SOCKS5 proxy
import (
"net"
"net/http"
"time"
"golang.org/x/net/proxy"
)
type Auth = proxy.Auth