Skip to content

Instantly share code, notes, and snippets.

View mtshrmn's full-sized avatar
🎓
Procrastinating

Moshe Sherman mtshrmn

🎓
Procrastinating
View GitHub Profile
@mtshrmn
mtshrmn / run_test.sh
Last active February 22, 2024 13:49
234123 hw2 tests
curl -L "https://gist.githubusercontent.com/mtshrmn/27b4112ac2b90ed001014883a1a900c7/raw/48828c04b5b7dca93624283761398fef713aff2c/test.c" > hw2test.c && gcc hw2test.c -o hw2test && chmod +x hw2test && ./hw2test && rm hw2test && rm hw2test.c
@mtshrmn
mtshrmn / watex
Created February 4, 2024 15:18
render latex formulas on the fly
#!/bin/sh
set -e
tmpdir=$(mktemp -d)
file=$1
opened_pdf=0
cleanup() {
rm -r "$tmpdir" 2> /dev/null
trap - TERM INT EXIT
@mtshrmn
mtshrmn / PKGBUILD
Last active February 22, 2024 13:30
nerd-fonts-complete
# Maintainer:Francois Menning <f.menning@pm.me>
# Contributor: Super Bo <supernbo at gmail dot com>
# Contributor: glider <samtron1412 {at} gmail {dot} com>
# Contributor: devopsdeluxe <dan.ray.beste@gmail.com>
_gitname='nerd-fonts'
pkgname='nerd-fonts-complete'
pkgver=2.2.2
pkgrel=2
pkgdesc='Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts.'
@mtshrmn
mtshrmn / nyaflix.sh
Last active August 3, 2023 15:03
my anime streaming workflow, condensed into the terminal
#!/bin/sh
set -e
nyaash -t anime_english "$*" |
sed -E "N;N;N;N;s/[0-9]+ \[Anime \- English\-translated\]\: (.+)\n(.+)\nsize: [0-9]+\.?[0-9]? [MG]iB date: (.+)\n.+\n/\\3 \| \1\t\2/g" |
fzf --delimiter="\t" --no-sort --with-nth 1 |
cut -f2 |
xargs -I{} peerflix {} --mpv
@mtshrmn
mtshrmn / csl3mount.sh
Last active August 3, 2023 15:06
easily mount the csl3 technion server over sshfs
#!/bin/sh
set -e
username=""
pin=""
exit_script() {
sftpman umount csl3
trap - SIGINT SIGTERM
kill -- -$$
@mtshrmn
mtshrmn / pbnotify.py
Last active February 20, 2022 17:28
Mirror PushBullet notifications
import json
import time
from threading import Thread
import websocket
from base64 import b64decode
import subprocess
import os
from tempfile import TemporaryDirectory
@mtshrmn
mtshrmn / stream.js
Last active March 31, 2020 16:57
stream torrent videos to the browser
import express from "express";
import Webtorrent from "webtorrent";
import parseRange from "range-parser";
import rimraf from "rimraf";
const app = express();
// once the server starts, a new webtorrent client will start.
const client = new Webtorrent();
@mtshrmn
mtshrmn / generate-context.js
Last active March 23, 2019 20:59
Generating React contexts with ease!
import React, {createContext, useReducer} from "react";
const generateContext = ({initialState = {}, reducer}) => {
const Context = createContext(initialState);
const provideComponent = Component => {
const wrapper = props => {
const [store, dispatch] = useReducer(reducer, initialState);
return (
<Context.Provider value={{store, dispatch}}>
<Component {...props}/>
@mtshrmn
mtshrmn / .eslintrc.js
Last active March 15, 2019 18:03
my eslintrc
module.exports = {
env: {
es6: true,
node: true,
browser: true,
jest: true,
},
extends: ["eslint:recommended", "plugin:react/recommended"],
parser: "babel-eslint",
parserOptions: {
@mtshrmn
mtshrmn / randomreddit.html
Last active April 4, 2017 11:36
tired of pressing that "random" button over and over? here's the solution.
<script>
function sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
var delay = 5000; //adjust time to suit your liking. the lower, the faster
window.setInterval(function () {
var page = window.open('http://reddit.com/r/random');
sleep(delay).then(() => page.close();)
}, delay + 200);
</script>