Skip to content

Instantly share code, notes, and snippets.

View manish's full-sized avatar

Manish Sinha manish

View GitHub Profile
@regstrtn
regstrtn / minmaxheap.py
Last active April 27, 2023 14:52 — forked from gnarmis/minmaxheap.py
min max heap implementation in python
from math import log, floor, pow
class MinMaxHeap(object):
def __init__(self, array=[]):
super(MinMaxHeap, self).__init__()
self.heap = [0]
for i in array:
self.Insert(i)
#!/usr/bin/env bash
nogitdir="/tmp/nogitsubmodulesfrommake"
mkdir -p "$nogitdir"
git="$(which git)"
{ cat <<EOF
#!/usr/bin/env bash
if [ "\$1" = "submodule" ]; then
echo "*** INSANITY: someone is messing with git submodules in a Makefile"
echo "*** not running this command:"
@rduplain
rduplain / README.md
Last active December 6, 2023 15:08
Demo of the Python `code` module, for interaction and DSLs.

import code

This is a demonstration of the Python [code][1] module, which allows for an interactive interpreter to be embedded into a Python program.

code.interact(banner=None, readfunc=None, local=None)

Convenience function to run a read-eval-print loop. This creates a new instance of [InteractiveConsole][2] and sets readfunc to be used as the

@piccaso
piccaso / ssh.cs
Last active August 6, 2024 19:59
ssh.net Example - Keybased Authentication, File Upload, Shell Commands
/*
get SSH.NET (BSD License: http://sshnet.codeplex.com/license)
with NuGet:
>Install-Package SSH.NET -Version 2013.4.7
or just get the dll from here: http://j.mp/sshNet
*/
using System;
@hkondo
hkondo / CGDisplayCreateImage.m
Created June 14, 2014 22:31
Capture Screen Images
//
// main.m
// Screenshot
//
// Created by Hideki KONDO on 2014/06/14.
// Copyright (c) 2014年 Hideki KONDO. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
@gnarmis
gnarmis / minmaxheap.py
Created January 27, 2013 10:01
min max heap implementation in python
from math import log, floor, pow
class MinMaxHeap(object):
"""an implementation of min-max heap using an array,
which starts at 1 (ignores 0th element)
"""
def __init__(self, array=[]):
super(MinMaxHeap, self).__init__()
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 28, 2025 00:02
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:

@GenjiApp
GenjiApp / NSImage+DrawAttributedString.h
Created December 25, 2011 07:07
NSImage's category for drawing attributed string
#import <AppKit/AppKit.h>
@interface NSImage (DrawAttributedString)
+ (NSImage *)imageWithAttributedString:(NSAttributedString *)attributedString
backgroundColor:(NSColor *)backgroundColor;
+ (NSImage *)imageWithAttributedString:(NSAttributedString *)attributedString;
+ (NSImage *)imageWithString:(NSString *)string;
@end