Skip to content

Instantly share code, notes, and snippets.

View Vivelin's full-sized avatar
🏳️‍🌈

Laura Verdoes Vivelin

🏳️‍🌈
View GitHub Profile
@Vivelin
Vivelin / prompt.sh
Created July 27, 2013 16:33
Simply colored bash prompt in CentOS
# /etc/profile.d/prompt.sh
if [ "$PS1" ]; then
if [[ ${EUID} == 0 ]] ; then
PS1='\[\033[01;31m\]\H\[\033[01;34m\] \w \$\[\033[00m\] '
else
PS1='\[\033[01;32m\]\u@\H\[\033[01;34m\] \w \$\[\033[00m\] '
fi
fi
@Vivelin
Vivelin / gist:6112013
Created July 30, 2013 10:59
This is why you need Option Strict On.
Dim list As IList(Of String) = text.Split(" ")
Dim number As String = ""
For Each entry In list
If Char.IsDigit(entry) Then
number = entry
Exit For
End If
Next
If number = 1 Then
Return True
@Vivelin
Vivelin / Preferences.sublime-settings
Last active June 11, 2016 07:40
Sublime Text 3 - User settings
{
"auto_close_tags": false,
"auto_complete_commit_on_tab": true,
"auto_match_enabled": false,
"bold_folder_labels": true,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/User/SublimeLinter/brogrammer (SL).tmTheme",
"copy_with_empty_selection": false,
"font_face": "Input",
@Vivelin
Vivelin / Configuration.cs
Created November 16, 2016 15:21
Vivelin.Environment.Configuration usage example
namespace Vivelin.Environment
{
public class Configuration
{
public Configuration() : this(new JsonConfigurationProvider())
{ }
public Configuration(IConfigurationProvider provider)
{
File = provider;
@Vivelin
Vivelin / TextWriterDbInterceptor.cs
Created April 4, 2018 13:51
An Entity Framework IDbInterceptor that suppresses execution of insert and update statements and instead writes them to a TextWriter.
using System;
using System.Data.Common;
using System.Data.Entity.Infrastructure.Interception;
using System.Data.SqlClient;
using System.IO;
/// <summary>
/// Represents an interceptor that writes insert and update statements to a
/// <see cref="TextWriter"/> instead of executing them against a database.
/// </summary>
@Vivelin
Vivelin / DuplicatePropertySchemaFilter.cs
Created August 30, 2018 10:57
A Swagger `ISchemaFilter` that removes duplicate properties in `allOf` schemas
/// <summary>
/// Represents a Swagger filter that removes duplicate properties in 'allOf'
/// schema definitions.
/// </summary>
public class DuplicatePropertySchemaFilter : ISchemaFilter
{
private const string DefinitionsRefPrefix = "#/definitions/";
/// <summary>
/// Removes duplicate properties from the specified schema.
@Vivelin
Vivelin / Accidental video close warning.user.js
Last active October 14, 2018 10:16
A user script to confirm closing a tab that contains a playing video.
// ==UserScript==
// @name Accidental video close warning
// @namespace https://vivelin.net/
// @version 0.2
// @description Warns before closing a tab that contains a playing video.
// @author Vivelin
// @updateURL https://gist.github.com/Vivelin/3cbc351cc4b2431f48918212548c788b/raw/Accidental%2520video%2520close%2520warning.user.js
// @match *://*/*
// @grant none
// ==/UserScript==
Param (
[Parameter(Mandatory = $true)][String]$subscriptionId,
[Parameter(Mandatory = $true)][String]$sourceResourceGroupName,
[Parameter(Mandatory = $true)][String]$sourceSiteName,
[Parameter(Mandatory = $true)][String]$targetResourceGroupName,
[Parameter(Mandatory = $true)][String]$targetSiteName
)
$ErrorActionPreference = "Stop"
@Vivelin
Vivelin / .bashrc
Last active May 13, 2019 13:19
Ubuntu basic powerline prompt
# For regular users
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32;07m\] \u \[\033[01;44;27m\]\[\033[0;07;34m\] \w \[\033[34;27m\]\[\033[00;27m\] '
# For root
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31;07m\] \u \[\033[01;44;27m\]\[\033[0;07;34m\] \w \[\033[34;27m\]\[\033[00;27m\] '
@Vivelin
Vivelin / prompt.txt
Created May 16, 2019 06:06
Basic powerline prompts for Windows Command Prompt
# Edit environment variables for your account -> PROMPT
# Replace %username% with the desired name, otherwise it is replaced by SYSTEM
$E[30;102m$S%username%$S$E[34;7m$E[34;40m$M$S$P$S$E[27m$E[0m$S
# Edit the system environment variables -> PROMPT
$E[30;101m$S⚡$S$E[34;7m$E[34;40m$M$S$P$S$E[27m$E[0m$S