Skip to content

Instantly share code, notes, and snippets.

@mholt
mholt / main.go
Created October 16, 2018 14:25 — forked from KatelynHaworth/main.go
Example of run an interactive process on the current user from system service on windows (Golang)
package main
import (
"github.com/kardianos/service"
"log"
"flag"
)
type Service struct {}
@thagxt
thagxt / mage2-multiweb-subdir.md
Last active April 24, 2024 09:19
Set up Magento 2 multiple websites in sub directories

Set up Magento 2 multiple websites in sub directories

  1. Go to Admin > Stores > All Stores
  2. Click > Create Web Site
  3. In the Name field, enter store name.
    • e.g. Japan
  4. In the Code field, enter a unique string without spaces and > Save Web Site
    • e.g. super_jp
  5. Create Store
  6. Create Store View
@vncsna
vncsna / bash_strict_mode.md
Created June 6, 2021 01:59 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
Extracted from http://makeitinireland.com/tech-map/ using js in google chrome console
$(".article").each(function(){
console.log($(this).find("h3").html() + " -- "+ $(this).find("#company_size").html() + " -- " + $(this).find("#company_address").html());
});
Company name -- Company size -- Company address
Synchronoss Software Ireland Ltd. -- Mid-sized Company -- The Academy, 42 Pearse St., Dublin 2
Fishtree -- Startup -- Fumbally Lane, Dublin
@JohnLBevan
JohnLBevan / Test-PSCredentials.ps1
Created July 14, 2015 13:05
Test-PSCredentials: Check if an AD account's password is valid
#http://serverfault.com/questions/276098/check-if-user-password-input-is-valid-in-powershell-script
$cred = Get-Credential #Read credentials
$username = $cred.username
$password = $cred.GetNetworkCredential().password
# Get current domain using logged-on user's credentials
$CurrentDomain = "LDAP://" + ([ADSI]"").distinguishedName
$domain = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain,$UserName,$Password)
if ($domain.name -eq $null)
@kkrypt0nn
kkrypt0nn / ansi-colors-discord.md
Last active April 24, 2024 09:14
A guide to ANSI on Discord

A guide to ANSI on Discord

Discord is now slowly rolling out the ability to send colored messages within code blocks. It uses the ANSI color codes, so if you've tried to print colored text in your terminal or console with Python or other languages then it will be easy for you.

Quick Explanation

To be able to send a colored text, you need to use the ansi language for your code block and provide a prefix of this format before writing your text:

\u001b[{format};{color}m

\u001b is the unicode escape for ESCAPE/ESC, meant to be used in the source of your bot (see ). If you wish to send colored text without using your bot you need to copy the character from the website.

@hyperdefined
hyperdefined / cobalt.md
Last active April 24, 2024 09:13
cobalt instance dump I found online

How did you find these?

I used a service called Censys Search to find them. There's some queries you can do:

  • services.http.response.html_title: "cobalt"
    • This one can find web instances. Does lead to false positives, since any title can contain "cobalt."
  • services.http.response.body_hash="sha1:bf53b9ab96065ed263df9ebcd2b3b0c4d88242b5"
    • This one can find API instances. This is the hash of the response that all instances use.
  • You can probably also look for just port 9001/9000, but most of these ports are not default.

After I collected the list, I checked /api/serverInfo on the API instances to see if it has a url set. This can either be a subdomain or an IP. If it had a domain set, I tried to find the web instance by checking common subdomains (like co, cobalt, etc). If there were no connecting domains, I tried a look up the IP on SecurityTrails. Otherwise, it simply got listed as the IP.

@klo2k
klo2k / gist:fe794f107c11292ba47b4d052c547983
Created February 12, 2022 08:01
Install virt-manager in Windows 11 WSL (qemu, Windows Subsystem for Linux)
# Inside WSL...
# Install virt-manager
sudo apt install -y virt-manager
# Add youself to kvm and libvirt group
sudo usermod --append --groups kvm,libvirt "${USER}"
# Fix-up permission to avoid "Could not access KVM kernel module: Permission denied" error
sudo chown root:kvm /dev/kvm
@Local9
Local9 / mpstatssetup.xml
Created May 16, 2019 10:52 — forked from rafaellm2/mpstatssetup.xml
mpstatssetup
<!--
#############################################################################################################
#############################################################################################################
#############################################################################################################
READ THIS BEFORE STARTING
READ THIS BEFORE STARTING
READ THIS BEFORE STARTING
READ THIS BEFORE STARTING
@bumi
bumi / yjs-pg-server.js
Created March 20, 2020 10:04
implementation of a websocket server storing yjs documents in a postgresql database
const WebSocket = require('ws');
const http = require('http');
const Y = require('yjs');
const wsUtils = require('./utils');
const cookie = require('cookie');
const QuillDelta = require('quill-delta');
//const QuillConverter = require('node-quill-converter');
//const MdastFromQuillDelta = require('mdast-util-from-quill-delta');