Skip to content

Instantly share code, notes, and snippets.

View mmangione's full-sized avatar

Micah Mangione mmangione

View GitHub Profile
@qdm12
qdm12 / readme.md
Last active April 8, 2024 08:45
Wireguard setup for Ubuntu server with LAN access

Wireguard setup for LAN access

Assumptions

  • The network 192.168.1.0/24 is your LAN
  • Your Ubuntu server is on your LAN at 192.168.1.10, through the network interface eth0
  • The network 192.168.5.0/24 is non existent
  • Your LAN DNS is at 192.168.1.1
@bshishov
bshishov / forecasting_metrics.py
Last active July 19, 2024 18:17
Python Numpy functions for most common forecasting metrics
import numpy as np
EPSILON = 1e-10
def _error(actual: np.ndarray, predicted: np.ndarray):
""" Simple error """
return actual - predicted
[options]
#
# WARNING:
# If you use the Odoo Database utility to change the master password be aware
# that the formatting of this file WILL be LOST! A copy of this file named
# /etc/odoo/openerp-server.conf.template has been made in case this happens
# Note that the copy does not have any first boot changes
#-----------------------------------------------------------------------------
# Odoo Server Config File - TurnKey Linux
@headsrooms
headsrooms / example.py
Created July 24, 2017 18:23
Python logger as a context manager
import logging
from logger import log_level
def message(self, message):
with log_level(logging.INFO, __name__) as logger:
input_args = [EXECUTABLE_NAME, SEND_COMMAND]
try:
process = subprocess.Popen(input_args,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
@BeanBagKing
BeanBagKing / hashcat_help.txt
Created November 8, 2016 18:52
Hashcat Help Documentation
hashcat64.exe -a 0 -w 0 -m 1000 -r rules/lmNTLM.rule hashes/ntlm.txt lists/lab.txt
hashcat64.exe -a 0 -w 1 -m 1800 hashes/unixmd5.txt lists/rockyou.txt
hashcat64.exe -a 3 -w 1 -m 1800 --increment ?a?a?a?a?a hashes/unixmd5.txt
C:\hashcat-3.10>hashcat64.exe -h
hashcat, advanced password recovery
Usage: hashcat [options]... hash|hashfile|hccapfile [dictionary|mask|directory]...
@sourcec0de
sourcec0de / haproxy.cfg
Created October 18, 2016 16:04
Here's a sample WORKING haproxy config for websockets / socketio. We were able to get socketio working on an Amazon ELB with just one node, but when we added multiple nodes, we saw weird client issues. So, we decided to use HAProxy on Ubuntu 12.04 and spent significant time trying to get just the right configuration (haproxy.cfg). Note though th…
global
#debug
#daemon
log 127.0.0.1 local0
defaults
log global
option httplog
frontend unsecured *:80
@divyavanmahajan
divyavanmahajan / create_user.sh
Last active October 28, 2017 16:22
Turnkey OpenVPN - Add new users. It creates two OVPN files - with and without proxy and also generates the URLs to download them. Safely use for existing users - it just creates the OVPN files.
#!/bin/bash -e
fatal() { echo "FATAL: $@" 1>&2; exit 1; }
warn() { echo "WARN: $@"; }
info() { echo "INFO: $@"; }
usage() {
cat <<EOF
Usage: sudo $0 client_or_profile_name
This will create two ovpn files in this directory (proxy and noproxy).
@mattplacer
mattplacer / full_screen.py
Last active October 16, 2016 23:43
Quickie workaround for Chrome+WebDriver full-page screenshots
def chrome_screenshot(self, filename):
h = 1080
w = 1920
d = self.driver
p_w = int(d.execute_script("return document.body.offsetWidth"))
p_h = int(d.execute_script("return document.body.parentNode.scrollHeight"))
b_w = int(d.execute_script("return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;"))
b_h = int(d.execute_script("return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;"))
c_w = w - p_w
c_h = h - b_h

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
@loderunner
loderunner / 01-mac-profiling.md
Last active July 12, 2024 03:52
Profiling an application in Mac OS X

Profiling an application in Mac OS X

Finding which process to profile

If your system is running slowly, perhaps a process is using too much CPU time and won't let other processes run smoothly. To find out which processes are taking up a lot of CPU time, you can use Apple's Activity Monitor.

The CPU pane shows how processes are affecting CPU (processor) activity: