Skip to content

Instantly share code, notes, and snippets.

@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');
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@JonTheNiceGuy
JonTheNiceGuy / AAA_Readme for wp-upgrade.sh.md
Created June 5, 2020 07:20
A simple script to upgrade all wordpress components in cron

wp-update.sh

A simple tool to update and upgrade Wordpress components

A few years ago, I hosted my blog on Dreamhost. They've customized something inside the blog which means it doesn't automatically update itself. I've long since moved this blog off to my own hosting, but I can't figure out which thing it was they changed, and I've got so much content and stuff in here, I don't really want to mess with it.

Anyway, I like keeping my systems up to date, and I hate logging into a blog and finding updates are pending, so I wrote this script. It uses wp-cli which I have installed to /usr/local/bin/wp as per the install guide.