Skip to content

Instantly share code, notes, and snippets.

@mnmly
mnmly / install-yak-for-mac.sh
Created September 9, 2019 09:15
Install Grasshopper Package Manager yak on mac
cd /Applications/Rhinoceros.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources
mkbundle --simple -o yak yak.exe
ln -s /Applications/Rhinoceros.app/Contents/Frameworks/RhCore.framework/Versions/A/Resources/yak /usr/local/bin/yak
@dalexsoto
dalexsoto / HttpClientProgressExtensions.cs
Last active April 3, 2024 15:01
Add Progress reporting to capabilities to HttpClient
using System;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace HttpClientProgress {
public static class HttpClientProgressExtensions {
public static async Task DownloadDataAsync (this HttpClient client, string requestUrl, Stream destination, IProgress<float> progress = null, CancellationToken cancellationToken = default (CancellationToken))
{
@jbnunn
jbnunn / Gist
Last active April 6, 2021 16:38 — forked from kurokikaze/gist:350fe1713591641b3b42
Install Google Chrome from Powershell
$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor = "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)
@DanielSWolf
DanielSWolf / Program.cs
Last active May 2, 2024 18:33
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
Param(
[parameter(Mandatory=$true)]
[alias("f")]
$FilePath,
[alias("b")]
$BuildTypeId,
[alias("s")]
$ServerUrl,
[parameter()]
[alias("o")]
@mattfelten
mattfelten / .bashrc
Last active December 11, 2015 07:58 — forked from TRMW/.bashrc
Forked from https://gist.github.com/4527673 which was still was broken for me. This fixed it. And now I know how to change the colors.
function parse_git_branch {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/'
}
export PS1='\[\e[0;35m\]⌘\[\e[0m\] \[\e[0;36m\]\w/\[\e[0m\] \[\e[0;33m\]$(parse_git_branch)\[\e[0m\]'
@andphe
andphe / gist:3232343
Created August 2, 2012 01:41
Export your links from Safari reading list
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@bengolder
bengolder / gist:1974640
Last active January 29, 2021 13:24
Make DataTree with Python in Grasshopper
import Rhino
import scriptcontext
# for accesssing GH classes
import clr
clr.AddReference("Grasshopper")
from Grasshopper.Kernel.Data import GH_Path
from Grasshopper import DataTree
@pearswj
pearswj / shef2csv.c
Created January 18, 2012 14:54
A short C program to parse tab separated UoS module timetable data to Google .csv format.
/* ---------------------------------------------------------------------------------
SHEF2CSV by Will Pearson
A simple C program for converting tab separated UoS module timetable data to Google
.csv format.
Usage: redirect stdin/stdout, e.g.
$ ./shef2csv < input.txt > output.csv
@ralfebert
ralfebert / gist:1255969
Created October 1, 2011 12:17
Ruby String helpers: indent, to_javadoc, markdown, pygmentize
# Placed in Public Domain by Ralf Ebert, 2008
#
# THIS SOFTWARE IS PROVIDED BY Ralf Ebert ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Ralf Ebert BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT