Skip to content

Instantly share code, notes, and snippets.

@staltz
staltz / migration-guide.md
Last active December 19, 2023 22:14
How to show migration guides in GitHub Markdown

How to show migration guides in GitHub Markdown

Use the diff code highlighting tag.

  ```diff
  - foo
  + bar

Example:

@davideicardi
davideicardi / mongo-docker.bash
Last active July 16, 2023 18:18
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@renshuki
renshuki / ubuntu_agnoster_install.md
Last active August 4, 2025 18:48
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@zwacky
zwacky / spread-example.js
Last active January 20, 2016 15:13
ES6 spread to the rescue
// get all items of all players
/* WITHOUT ES6 spread operator */
const items = [];
players.forEach((player) => {
player.forEach((item) => {
items.push(item);
});
});
@GabLeRoux
GabLeRoux / couchdb
Last active March 16, 2016 20:36
Couchdb 1.6.1 Ubuntu 14.04 init script that goes in /etc/init.d Generated using https://github.com/pixelpark/ppnet/wiki/Install-CouchDB-1.6.1-on-Ubuntu-14.04
#!/bin/sh -e
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
/**
* e.g. retrieving field values from a form.
*/
function getDateFromForm() {
const props = ['year', 'month', 'day', 'hour', 'minutes', 'sec', 'milisec'];
return props.map((prop) => {
return document.querySelector(`#${prop}`).text;
});
}
@Xyl2k
Xyl2k / heartbleed.py
Created February 16, 2016 15:39
Python Heartbleed (CVE-2014-0160) Proof of Concept
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
# Edited spl0it to loop and save cookies.
import sys
import struct
import socket
import time
# Simulate fake processes of analysis sandbox/VM that some malware will try to evade
# This just spawn ping.exe with different names (wireshark.exe, vboxtray.exe, ...)
# It's just a PoC and it's ugly as f*ck but hey, if it works...
# Usage: .\fake_sandbox.ps1 -action {start,stop}
param([Parameter(Mandatory=$true)][string]$action)
$fakeProcesses = @("wireshark.exe", "vmacthlp.exe", "VBoxService.exe",
"VBoxTray.exe", "procmon.exe", "ollydbg.exe", "vmware-tray.exe",
@lokhman
lokhman / ubuntu-hardening.md
Last active July 17, 2025 21:27
List of things for hardening Ubuntu

WARNING

May contain out of date information. Check the comments below!

The list of actions listed below was taken mostly from Book Of Zeus with minor modifications and did the job well for Ubuntu version, which was available at that moment (May 2016). This gist was created for internal use and was never meant to be discovered by the web, although Google managed to find and index this page, which was a great surprise for me. Please check the original source for the updated information (links are provided in most of the sections), and read the comments below: they provide more details about the usage experience.

System Updates

http://bookofzeus.com/harden-ubuntu/initial-setup/system-updates/

Keeping the system updated is vital before starting anything on your system. This will prevent people to use known vulnerabilities to enter in your system.