Skip to content

Instantly share code, notes, and snippets.

View crosstyan's full-sized avatar

Crosstyan crosstyan

View GitHub Profile
@crosstyan
crosstyan / paste.vim
Created January 21, 2022 11:18 — forked from romainl/paste.vim
Sharing is caring
" Mac OS X (requires curl)
" ------------------------
command! -range=% SP <line1>,<line2>w !curl -F 'sprunge=<-' http://sprunge.us | tr -d '\n' | pbcopy
command! -range=% CL <line1>,<line2>w !curl -F 'clbin=<-' https://clbin.com | tr -d '\n' | pbcopy
command! -range=% VP <line1>,<line2>w !curl -F 'text=<-' http://vpaste.net | tr -d '\n' | pbcopy
command! -range=% PB <line1>,<line2>w !curl -F 'c=@-' https://ptpb.pw/?u=1 | tr -d '\n' | pbcopy
command! -range=% IX <line1>,<line2>w !curl -F 'f:1=<-' http://ix.io | tr -d '\n' | pbcopy
command! -range=% EN <line1>,<line2>w !curl -F 'file=@-;' https://envs.sh | tr -d '\n' | pbcopy
command! -range=% TB <line1>,<line2>w !nc termbin.com 9999 | tr -d '\n' | pbcopy
@crosstyan
crosstyan / Readme.md
Created March 10, 2022 11:28 — forked from Sebb767/Readme.md
Escape The Matrix (Dark Web Article)

This is the famous escape the matrix article from the hidden wiki. Since most mirrors are down and on the hidden wiki itself, the first chaper was replaced with a bitcoin scam, I thought I repost this here. Copyright goes to the original author and I'm not stating any opinion on this text except that it may or may not be an interesting read ;)

The .txt version is taken from here (there's also an intepretation where that came from), the markdown version was converted via some regexes by, well, me.

Have fun :)

@crosstyan
crosstyan / A-sum-higher-kinds.clj
Created March 23, 2022 15:31 — forked from ckirkendall/A-sum-higher-kinds.clj
Polymorphism - Summation of Higher Kinds(Clojure, Ocaml, Haskell, Scala, Java).
(defrecord Tree [left elm right])
(defprotocol Monoid
(append [a b] )
(identity [a] ))
(defprotocol Foldable
(foldl [l f i])
(mfirst [l]))
@crosstyan
crosstyan / project.clj
Created March 31, 2022 17:21
an example of clojure udp server using aleph
(defproject udp-server "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[org.clojure/clojure "1.10.3"]
[aleph "0.4.6"]
[org.clojure/core.match "1.0.0"]]
:repl-options {:init-ns udp-server.core})
@crosstyan
crosstyan / 25t.csv
Last active April 13, 2022 05:52
example using hy to plot some data. x is the domain and y is the number in that bin.
x y
318 37
319 58
320 130
321 142
322 252
323 458
324 530
325 700
326 688
;; in 1.0a4 no need of bracket
(import numpy :as np
pandas :as pd
random [random]
functools [reduce]
seaborn :as sns
matplotlib.pyplot :as plt
scipy.stats [norm]
os [listdir])
@crosstyan
crosstyan / client.py
Created April 27, 2022 12:46 — forked from bashkirtsevich/client.py
asyncio UDP client
import asyncio
class EchoClientProtocol:
def __init__(self, message, loop):
self.message = message
self.loop = loop
self.transport = None
def connection_made(self, transport):
self.transport = transport
@crosstyan
crosstyan / 00-NOTES.md
Created April 28, 2022 17:06 — forked from krisleech/00-NOTES.md
Notes on Clojure ring handlers and middleware

Ring handler a function which accepts a request (map) and returns a response (map).

Ring middleware

function (handler, &args -> function(request -> response) because it is a closure handler and &args are in scope within the returned handler function.

a function which accepts a "next handler" (the next handler in the chain) + any extra arguments and returns a handler (function), which will accept a request and return a response.

@crosstyan
crosstyan / deadsnakes-python39-ubuntu-bionic.md
Created May 31, 2022 07:11
Deadsnakes python 3.9 on Ubuntu 18.04 LTS

Deadsnakes python 3.9 on Ubuntu 18.04 LTS

NOTE: Recently switched back to using pyenv so I can run multiple python versions without losing my mind. It only takes a few minutes to set up, but provides the flexibility I need without making things too complicated. See my gist, Manage python versions on Linux with pyenv for more.

The deadsnakes PPA make the latest stable versions of python available on Ubuntu 18.04 LTS (3.9 is already in the official apt repo for 20.04). I now find it preferable to installing from source.

The following was tested on a Ubuntu 18.04.5 LTS desktop with python 3.6.9 as the system python version ("python3").

The latest python available from deadsnakes as of July, 2021 is 3.9.6.

Prerequisites

@crosstyan
crosstyan / mongo-cheatsheet.md
Last active October 24, 2022 07:34 — forked from dittmaraz/mongo-cheatsheet.md
MongoDB/Docker Cheatsheet

Mongo/Docker Cheatsheet

To download the latest image:

$ docker pull mongo:latest

To run a mongo container with detached mode(-p) and with ports mapped (-p 27017-27017:27017-27019) and named (--name mongodb):

$ docker run -d -p 27017-27019:27017-27019 --name mongodb mongo:latest