Skip to content

Instantly share code, notes, and snippets.

@spoof
spoof / DVRIP-Sonia Reference Codes.md
Created December 8, 2022 10:29 — forked from ekwoodrich/DVRIP-Sonia Reference Codes.md
Reference codes for the DVRIP/Sonia TCP protocol used by the Net Surveillance ActiveX plugin

DVRIP/Sonia Protocol

DVRIP/Sonia TCP protocol used by the Net Surveillance ActiveX plugin

1. Response Codes

Return code Definition
100 Success
101 Unknown error
102 Version not supported
103 Illegal request
@spoof
spoof / TrueColour.md
Created July 12, 2021 20:21 — forked from XVilka/TrueColour.md
True Colour (16 million colours) support in various terminal applications and terminals

Terminal Colors

There exists common confusion about terminal colors. This is what we have right now:

  • Plain ASCII
  • ANSI escape codes: 16 color codes with bold/italic and background
  • 256 color palette: 216 colors + 16 ANSI + 24 gray (colors are 24-bit)
  • 24-bit true color: "888" colors (aka 16 milion)
lua << EOF
local nvim_lsp = require'nvim_lsp'
local log = require'vim.lsp.log'
nvim_lsp.rust_analyzer.setup{}
nvim_lsp.gopls.setup{}
function lsp_go_to_definition(cmd)
local params = vim.lsp.util.make_position_params()
return vim.lsp.buf_request(0, 'textDocument/definition', params, function(_, method, result)
@spoof
spoof / playground.rs
Created November 8, 2018 22:11 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#[warn(unused_variables)]
pub struct Letter {
text: String,
}
impl Letter {
pub fn new(text: String) -> Self {
Letter { text }
}
@spoof
spoof / my_test.py
Created May 18, 2018 10:58 — forked from seddonym/my_test.py
Django test class for asserting the connection of a receiver to a given signal
from django.test import TestCase
class ReceiverConnectionTestCase(TestCase):
"""TestCase that allows asserting that a given receiver is connected to a signal.
Important: this will work correctly providing you:
1. Do not import or patch anything in the module containing the receiver in any django.test.TestCase.
2. Do not import (except in the context of a method) the module containing the receiver in any test module.
@spoof
spoof / pep484transform.py
Created April 23, 2018 09:02 — forked from davidhalter/pep484transform.py
Jedi generates Pep 484 type annotations.
"""
Transforms a normal Python file to pep484 annotations using Jedi.
Usage:
pep484transform.py <file> [-d]
Options:
-d, --debug Show Jedi's debug output.
"""
from os.path import abspath
@spoof
spoof / ViewTransformation.swift
Created March 2, 2018 17:34 — forked from ninjaprox/ViewTransformation.swift
Understanding UIView's tranform property
//: Playground - noun: a place where people can play
import UIKit
import XCPlayground
// MARK: - Helpers
extension UIView {
func addBorderWith(color: UIColor, width: CGFloat, alpha: CGFloat = 1) {
self.layer.borderColor = color.colorWithAlphaComponent(alpha).CGColor
@spoof
spoof / BluetoothRestart
Created January 16, 2018 22:39 — forked from ajmaradiaga/BluetoothRestart
Force Bluetooth Restart on Mac
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist
package main
import (
"net/http"
"database/sql"
"fmt"
"log"
"os"
)
@spoof
spoof / postgres_queries_and_commands.sql
Created April 14, 2016 11:41 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'