Skip to content

Instantly share code, notes, and snippets.

View mkhoeini's full-sized avatar

Mohammad Sadegh Khoeini mkhoeini

View GitHub Profile
@lehmacdj
lehmacdj / evil-mode.lisp
Last active August 6, 2019 10:00
Evil mode for nEXT browser
(in-package :next)
(defparenstatic scroll-half-page-down
(ps:chain window (scroll-by 0 (/ (ps:@ window inner-height) 2))))
(defparenstatic scroll-half-page-up
(ps:chain window (scroll-by 0 (/ (ps:@ window inner-height) -2))))
(defparenstatic scroll-page-down
(ps:chain window (scroll-by 0 (ps:@ window inner-height))))
(defparenstatic scroll-page-up
(ps:chain window (scroll-by 0 (- (ps:@ window inner-height)))))
@taesiri
taesiri / fftube.py
Last active August 24, 2017 12:20
Extract frames from youtube videos
import argparse
import youtube_dl
import ffmpy
samples_per_video = 10
game_dic = {}
def save_frame(url, time, game_name):
if game_name not in game_dic.keys():
game_dic[game_name] = 0

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

@lattner
lattner / TaskConcurrencyManifesto.md
Last active May 3, 2024 08:18
Swift Concurrency Manifesto
@yogthos
yogthos / gallery.cljs
Last active March 30, 2024 17:36
script to download walpapers from windowsonearth.org
@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@reborg
reborg / rich-already-answered-that.md
Last active May 5, 2024 04:45
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@mapmeld
mapmeld / OverEncrypt.md
Last active July 25, 2023 18:55
OverEncrypt - paranoid HTTPS

OverEncrypt

This is a guide that I wrote to improve the default security of my website https://fortran.io , which has a certificate from LetsEncrypt. I'm choosing to improve HTTPS security and transparency without consideration for legacy browser support.

WARNING: if you mess up settings, lose your certificates, or decide to no longer maintain HTTPS certs, these steps can and will make your domain inaccessible.

I would recommend these steps only if you have a specific need for information security, privacy, and trust with your users, and/or maintain a separate secure.example.com domain which won't mess up your main site. If you've been thinking about hosting a site on Tor, then this might be a good option, too.

The best resources that I've found for explaining these steps are https://https.cio.gov , https://certificate-transparency.org , and https://twitter.com/konklone

class Callback {
constructor(f) {
// this.run = f
this.run = callback => {
try {
f(callback)
} catch (ex) {
callback(ex, null)
}
@josevalim
josevalim / watcher.sh
Last active February 28, 2024 07:42
A 1LOC bash script for re-running tests whenever a lib/ or test/ file changes keeping the same VM instance
# You will need fswatch installed (available in homebrew and friends)
# The command below will run tests and wait until fswatch writes something.
# The --stale flag will only run stale entries, it requires Elixir v1.3.
fswatch lib/ test/ | mix test --stale --listen-on-stdin