Skip to content

Instantly share code, notes, and snippets.

@yorickvP
yorickvP / wl-clipboard.el
Created March 14, 2019 11:02
teach emacs to use wl-copy
(setq wl-copy-process nil)
(defun wl-copy (text)
(setq wl-copy-process (make-process :name "wl-copy"
:buffer nil
:command '("wl-copy" "-f" "-n")
:connection-type 'pipe))
(process-send-string wl-copy-process text)
(process-send-eof wl-copy-process))
(defun wl-paste ()
(if (and wl-copy-process (process-live-p wl-copy-process))
@anthonyeden
anthonyeden / simplistic-ffmpeg-streaming.py
Created May 28, 2018 11:46
Sending FFmpeg output to HTTP, via Python's Flash
"""
Streaming FFmpeg to HTTP, via Python's Flask.
This is an incredibly simple example, which will yield issues due to inconsistant input and output rates.
If you're going to use this, VLC works okay as a client.
You really need to move FFmpeg into a separate thread, which should help stream audio more consistantly to the HTTP client.
Example by Anthony Eden (https://mediarealm.com.au)
"""
from flask import Flask
@michelson
michelson / async_method_job.rb
Created April 23, 2024 01:50
Asynchronously Concern
class AsyncMethodJob < ApplicationJob
queue_as :default
def perform(target:, method_name:, args:, queue_name: :default)
self.class.queue_as(queue_name)
# `target` could be either an instance or a class
target = target.constantize if target.is_a?(String) # Convert class name to class object if needed
target.send(method_name, *args)
end
end
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active May 14, 2024 01:06
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@chainzero
chainzero / deploy.yml
Created September 12, 2023 14:20
Stable payment SDL example
---
version: "2.0"
services:
web:
image: ovrclk/e2e-test
expose:
- port: 8080
as: 80
to:
- global: true
@atoponce
atoponce / gist:07d8d4c833873be2f68c34f9afc5a78a
Last active May 14, 2024 00:59 — forked from tqbf/gist:be58d2d39690c3b366ad
Cryptographic Best Practices

Cryptographic Best Practices

Putting cryptographic primitives together is a lot like putting a jigsaw puzzle together, where all the pieces are cut exactly the same way, but there is only one correct solution. Thankfully, there are some projects out there that are working hard to make sure developers are getting it right.

The following advice comes from years of research from leading security researchers, developers, and cryptographers. This Gist was [forked from Thomas Ptacek's Gist][1] to be more readable. Additions have been added from

@w-e-w
w-e-w / sd-webui-txt2img-img2img-api-example.py
Last active May 14, 2024 00:53
Stable Diffusion web UI txt2img img2img api example script
from datetime import datetime
import urllib.request
import base64
import json
import time
import os
webui_server_url = 'http://127.0.0.1:7860'
out_dir = 'api_out'
@petersenna
petersenna / backup_history.bash
Last active May 14, 2024 00:50
Add this to your .bashrc to create a backup of your bash history every time you open a new terminal, but not more than one time per hour(find -mmin +60). This will backup your bash history if it has more lines than the backup file.
export HISTSIZE=""
HIST_FILE=~/.bash_history
BACK_FILE=~/.bash_history_backup
if [ ! -f $BACK_FILE ];then touch -d "2 hours ago" $BACK_FILE;fi
if test $(find $BACK_FILE -mmin +60); then
HIST_SIZE=$(cat $HIST_FILE|wc -l)
BACK_SIZE=$(cat $BACK_FILE|wc -l)
GROWTH=$(($HIST_SIZE - $BACK_SIZE))
@sebjai
sebjai / short_term_alpha.ipynb
Last active May 14, 2024 00:49
Market Making in Short-Term Alpha (Chapter 10.4.2 of Algorithmic and High-Frequency Trading by Cartea, Jaimungal, Penalva, published by Cambridge University Press)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.