Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@prabirshrestha
prabirshrestha / detect-os.sh
Created July 10, 2012 02:04
detect os in bash
#!/bin/sh
UNAME=$(uname)
if [ "$UNAME" == "Linux" ] ; then
echo "Linux"
elif [ "$UNAME" == "Darwin" ] ; then
echo "Darwin"
elif [[ "$UNAME" == CYGWIN* || "$UNAME" == MINGW* ]] ; then
@prabirshrestha
prabirshrestha / WebBrowserScriptExtensions.cs
Created June 2, 2012 18:17
WP7 web browser script extensions
using System;
using Microsoft.Phone.Controls;
public static class WebBrowserScriptExtensions
{
public static object ExecuteCode(this WebBrowser browser, string code)
{
return browser.InvokeScript("eval", "(function(){\r\n" + code + "\r\n})();");
}
@prabirshrestha
prabirshrestha / .bash_profile
Last active June 3, 2022 01:19
my terminal settings for windows
# curl -Lk https://gist.githubusercontent.com/prabirshrestha/279d8b179d9353fe8694/raw/.bash_profile -o ~/.bash_profile
[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh # This loads NVM
export PATH="$HOME/.cargo/bin:$HOME/go/bin:$HOME/Library/Python/3.7/bin:$PATH"
export PATH="$HOME/.config/nvim/plugins/vim-themis/bin:$PATH"
stty -ixon
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
@prabirshrestha
prabirshrestha / channel.log
Created April 16, 2022 21:02
native client lsp log
https://github.com/vim/vim/pull/10025
--------------
==== start log session ====
0.057482 : raw terminal output: "[?1049h[>4;2m[?1h=[?2004h[?1004h"
0.057531 : raw terminal output: "[?12h[?12l"
0.124131 : raw terminal output: "▽"
0.124184 : raw terminal output: " Pzz\[0%m"
@prabirshrestha
prabirshrestha / default.aspx
Created May 21, 2012 23:30
ASP.NET 4.5 WebSockets echo server
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
@prabirshrestha
prabirshrestha / socket.io.cs
Created May 22, 2012 15:56
socket.io 4 .net
namespace WebSocketHelloEchoServer.SocketIo
{
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.WebSockets;
using System.Reflection;
using System;
using System.Linq;
using System.Runtime.InteropServices;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.TextManager.Interop;
@prabirshrestha
prabirshrestha / gist:93efe102437180132438a715a64dd7e9
Created February 7, 2021 17:33
rust analyzer $/progress notifications
```
Sun 07 Feb 2021 05:23:29 PM UTC:["<---",1,"rust-analyzer",{"response":{"method":"$/progress","jsonrpc":"2.0","params":{"token":"rustAnalyzer/indexing","value":{"percentage":0,"message":"1/909 (alloc)","kind":"report"}}}}]
Sun 07 Feb 2021 05:23:29 PM UTC:["<---",1,"rust-analyzer",{"response":{"method":"$/progress","jsonrpc":"2.0","params":{"token":"rustAnalyzer/indexing","value":{"percentage":0,"message":"3/909 (panic_unwind)","kind":"report"}}}}]
Sun 07 Feb 2021 05:23:29 PM UTC:["<---",1,"rust-analyzer",{"response":{"method":"$/progress","jsonrpc":"2.0","params":{"token":"rustAnalyzer/indexing","value":{"percentage":0,"message":"4/909 (profiler_builtins)","kind":"report"}}}}]
Sun 07 Feb 2021 05:23:29 PM UTC:["<---",1,"rust-analyzer",{"response":{"method":"$/progress","jsonrpc":"2.0","params":{"token":"rustAnalyzer/indexing","value":{"percentage":0,"message":"5/909 (proc_macro)","kind":"report"}}}}]
Sun 07 Feb 2021 05:23:29 PM UTC:["<---",1,"rust-analyzer",{"response":{"method":"$/progress","jsonrpc":"2.0
@prabirshrestha
prabirshrestha / ConsoleProgress.cs
Created July 25, 2011 20:35
C# Console Progress
public class ProgressBar
{
private int _lastOutputLength;
private readonly int _maximumWidth;
public ProgressBar(int maximumWidth)
{
_maximumWidth = maximumWidth;
Show(" [ ");
}
@prabirshrestha
prabirshrestha / scriptcs.rb
Last active May 8, 2020 08:57
Scriptcs homebrew formula
# brew install --HEAD https://gist.github.com/prabirshrestha/5474490/raw/scriptcs.rb -v
# note: requires >= mono 3.0.6 (http://www.go-mono.com/mono-downloads/download.html)
require 'formula'
class Scriptcs < Formula
homepage 'https://github.com/dragan/scriptcs'
head 'https://github.com/dragan/scriptcs.git', :branch => 'mono-support'