Skip to content

Instantly share code, notes, and snippets.

View muammar's full-sized avatar
👋

Muammar El Khatib muammar

👋
View GitHub Profile
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 23, 2024 15:29
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@rubo77
rubo77 / download-mozilla-portable.sh
Last active February 22, 2024 06:46
a script that downloads a certain Firefox or Thunderbird version and installs it in an extra folder to create an independent and portable App for Linux. source: http://portableapps.com/node/16344
#!/bin/sh
# Configure the following default variables according to your requirements
language="en-US" # e.g. "de" or "en-US"
if [ ! "$1" ]; then
# default if no argument is set:
version="95.0" # chose from http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/
application="firefox" # "thunderbird" or "firefox" but file extension, archive extraction, and binary
fi
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from conformal.conformal_predictor import InductiveConformalPredictor
data = load_digits()
X, y = data.data, data.target
alpha = 0.05
seed = 41
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3,
@sbarratt
sbarratt / torch_jacobian.py
Created May 9, 2019 19:40
Get the jacobian of a vector-valued function that takes batch inputs, in pytorch.
def get_jacobian(net, x, noutputs):
x = x.squeeze()
n = x.size()[0]
x = x.repeat(noutputs, 1)
x.requires_grad_(True)
y = net(x)
y.backward(torch.eye(noutputs))
return x.grad.data
@kyleturner
kyleturner / Remove Submodule
Created January 5, 2012 01:07
How to remove a submodule from a Github project
To remove a submodule you need to:
Delete the relevant line from the .gitmodules file.
Delete the relevant section from .git/config.
Run git rm --cached path_to_submodule (no trailing slash).
Commit and delete the now untracked submodule files.
@gpleiss
gpleiss / reliability_diagram.py
Created May 23, 2018 23:42
Reliability diagram code
import torch
import numpy as np
from matplotlib import pyplot as plt
def make_model_diagrams(outputs, labels, n_bins=10):
"""
outputs - a torch tensor (size n x num_classes) with the outputs from the final linear layer
- NOT the softmaxes
labels - a torch tensor (size n) with the labels
"""
@jossef
jossef / colors.py
Last active February 2, 2023 20:39
python coloring for linux, based on this answer http://stackoverflow.com/a/26445590/3191896
def color(text, **user_styles):
styles = {
# styles
'reset': '\033[0m',
'bold': '\033[01m',
'disabled': '\033[02m',
'underline': '\033[04m',
'reverse': '\033[07m',
@cobookman
cobookman / gist:c1a9856a4588496b021a
Last active August 17, 2021 12:39
HTML5 Audio (mp3) and Video (webm) live transcoding streams

The following two functions will stream just about any audio or video file to any browsers supporting mp3 and/or webm. Due to the unknown number of bytes, a custom html5 audio/video player will have to be written (my next step) to allow seeking.

For w/e reason node.js didn't want to spawn a child process with a unix pipe in it. This could be so that they can keep support for windows computers. As such I've created the following bash script:

#!/bin/bash
START_TIME=${2:-0}
VARIABLE_BIT_RATE=${3:-4}
ABSOLUTE_PATH=$1
@duggan
duggan / cast.py
Last active November 28, 2020 21:55
Using pychromecast to headlessly stream youtube videos
#!/usr/bin/env python
"""
Requires pychromecast.
Install with `pip install pychromecast`
usage: cast.py [-h] -d DEVICE -v VIDEO
Cast YouTube videos headlessly.