Skip to content

Instantly share code, notes, and snippets.

@ZurgInq
ZurgInq / notification-mute.sh
Created November 29, 2021 05:04 — forked from orschiro/notification-mute.sh
Temporarily mute Ubuntu's notification for undisturbed work
#!/bin/bash
echo "Temporarily muting notifications until aborted..."
killall -s SIGSTOP notify-osd
keepgoing=1
trap '{ echo "sigint"; keepgoing=0; }' SIGINT
while (( keepgoing )); do
sleep 5
done
@ZurgInq
ZurgInq / mockRequest.php
Created March 7, 2019 11:09
php guzzle mock
<?php
function mockRequest($method, $uri, $headers, $response)
{
return function (RequestInterface $request, $options) use ($method, $uri, $headers, $response) {
if ($method != $request->getMethod()) {
throw new \LogicException("Invalid Mock: '$method'' expected");
}
$actual = $request->getUri();
if ($uri != $request->getUri()) {
@ZurgInq
ZurgInq / Interactor.php
Created February 7, 2019 18:06
php Interactor (Operation)
<?php
namespace Lib\Interactor;
trait Interactor
{
abstract function call();
public function __invoke()
{
@ZurgInq
ZurgInq / main.go
Created August 13, 2018 04:12
inheritance go lang
package main
import (
"fmt"
)
func main() {
user := NewUser("Jack Daniels")
client := NewClient("Jack", "Black")
@ZurgInq
ZurgInq / hidden_constants.rb
Created August 12, 2018 10:55
Add hidden constants to Ruby Object
class Object
def const_hide sym, obj
_hidden_consts.const_set sym, obj
Object.send :remove_const, sym
end
def hidden_constants
_hidden_consts.constants
end
@ZurgInq
ZurgInq / Gemfile
Last active March 14, 2018 20:32
Golang + RSpec Tutorial
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "rspec"
gem "rest-client"
gem "mockserver-client"
@ZurgInq
ZurgInq / main.go
Created May 2, 2017 19:35
Go auto update, auto restart (Windows)
package main
import (
"github.com/inconshreveable/go-update"
"net/http"
"log"
"fmt"
"github.com/kardianos/service"
"os"
"os/signal"
@ZurgInq
ZurgInq / logger.go
Created April 25, 2017 17:29
Go lang logger interface
package logger
type Logger interface {
Debug(args ...interface{})
Debugln(args ...interface{})
Info(args ...interface{})
Infoln(args ...interface{})
Warn(args ...interface{})
Warnln(args ...interface{})
Error(args ...interface{})
@ZurgInq
ZurgInq / bira-with-time.zsh-theme
Created September 28, 2016 06:41
bira ZSH theme with time
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
if [[ $UID -eq 0 ]]; then
local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}'
else
local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}'
fi
@ZurgInq
ZurgInq / mobile.htm
Created March 20, 2016 19:03
vlc mobile volume
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< mobile.html: VLC media player web interface - VLM
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< Copyright (C) 2005-2006 the VideoLAN team
< $Id$
<
< Authors: Brandon Brooks <bwbrooks -at- archmageinc -dot- com>
<
< This program is free software; you can redistribute it and/or modify
< it under the terms of the GNU General Public License as published by