Skip to content

Instantly share code, notes, and snippets.

View binaryfunt's full-sized avatar

Ronnie Dutta binaryfunt

  • 19:07 (UTC)
View GitHub Profile
set revert-all-at-newline on
"\e\e": kill-whole-line
"\e[A": history-search-backward
"\e[B": history-search-forward
@binaryfunt
binaryfunt / convert2gif
Created February 25, 2022 12:30
Convert video to .gif using ffmpeg. Optionally speed up the footage.
#!/usr/bin/env bash
set -eo pipefail
USAGE='
Usage:
$ convert2gif <input_video_file> <output_gif_file> [<speedup_factor>]
Convert video to .gif using ffmpeg. Optionally speed up the footage.
'
@binaryfunt
binaryfunt / Microsoft.PowerShell_profile.ps1
Last active May 20, 2024 12:54
Posh-git style powershell prompt
# IPython-like history search:
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
function Get-BranchName () {
try {
$branch = git rev-parse --abbrev-ref HEAD
if ($branch -eq "HEAD") {
@binaryfunt
binaryfunt / App.xaml.cs
Created August 1, 2018 10:37
JavaScript-style Alert() function implemented in Windows UWP
sealed partial class App : Application
{
...
private static List<ContentDialog> DialogQueue { get; } = new List<ContentDialog>();
public static async void Alert(string text)
{
var Dialog = new ContentDialog()
{
Title = text,
@binaryfunt
binaryfunt / Using Git to Manage a Live Web Site.md
Last active September 24, 2017 20:10 — forked from phamquocbuu/Using Git to Manage a Live Web Site.md
Using Git to Manage a Live Web Site

Using Git to Manage a Live Web Site

Overview

As a freelancer, I build a lot of web sites. That's a lot of code changes to track. Thankfully, a Git-enabled workflow with proper branching makes short work of project tracking. I can easily see development features in branches as well as a snapshot of the sites' production code. A nice addition to that workflow is that ability to use Git to push updates to any of the various sites I work on while committing changes.

Contents

@binaryfunt
binaryfunt / .gitconfig
Last active August 1, 2024 15:44
My gitconfig with useful aliases + custom scripts
# [filter "lfs"]
# clean = git-lfs clean -- %f
# smudge = git-lfs smudge -- %f
# process = git-lfs filter-process
# required = true
[core]
# editor = notepad
editor = code -w # -n --disable-extensions
[rerere]
enabled = true
@binaryfunt
binaryfunt / jupyter_notebook_config.py
Last active April 29, 2022 11:15
Jupyter notebooks - clear output pre-save hook (for cleaner git diffs)
# This file has to be saved in your Jupyter config directory (found by running
# jupyter --config-dir
# but usually C:\Users\<username>\.jupyter\jupyter_notebook_config.py on Windows
def scrub_output_pre_save(model, **kwargs):
"""scrub output before saving notebooks"""
# only run on notebooks
if model['type'] != 'notebook':
return
# only run on nbformat v4
@binaryfunt
binaryfunt / var_dump_pre.php
Created October 18, 2016 22:49
var_dump() but actually readable. Thanks to edwardyzang http://php.net/manual/en/function.var-dump.php#51119
function var_dump_pre($mixed = null) {
echo "<pre>";
var_dump($mixed);
echo "</pre>";
return null;
}
@binaryfunt
binaryfunt / font-example.py
Created September 25, 2015 10:44
Change fonts on Matplotlib plots in Python
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
# Set the font properties (can use more variables for more fonts)
font_path = 'C:\Windows\Fonts\AGaramondPro-Regular.otf'
font_prop = font_manager.FontProperties(fname=font_path, size=14)
ax = plt.subplot() # Defines ax variable by creating an empty plot