Skip to content

Instantly share code, notes, and snippets.

View dryliketoast's full-sized avatar

Michael Kane dryliketoast

View GitHub Profile
@grisu48
grisu48 / create_vm_snapshot.sh
Last active September 23, 2020 07:56
Shell script to stop KVM, create BTRFS snapshot and restart KVM machines again
#!/bin/bash
# Shell script to stop all KVM instances, create a BTRFS snapshot (read-only) and restart the stopped KVM instances
# https://gist.github.com/grisu48/535c27cd25c096248ce234ad81abf1b9
## Configuration ##############################################################
IMGDIR="/mnt/RAID/libvirt/images"
SNAPDIR="/mnt/RAID/libvirt/snapshots"
# timeout in seconds
TIMEOUT=300
@biinari
biinari / extract-123-reg-zonefile.js
Last active February 8, 2023 14:23
Script to extract the DNS entries from 123-reg advanced dns page
// Moved to a new home at https://github.com/biinari/zonefile-extract/tree/master/123-reg
@thelbouffi
thelbouffi / mailparse installation
Created September 25, 2016 11:05
how to instal mailparse on php7
REQUIREMENTS:
- php-pear (install automatically php7.0-xml and php-xml)
sudo apt-get install php-pear
-php7.0-mbstring
sudo apt-get install php7.0-mbstring
-php7.0-dev
sudo apt-get install php7.0-dev
INSTALLATION:
1- cd /tmp/xxxxxx (e.g: cd /tmp/pear/download)
@bigsan
bigsan / msgconvert.pl
Created August 3, 2016 06:59
Perl: Convert outlook .msg to .eml
perl -we 'use Email::Outlook::Message; print Email::Outlook::Message->new(shift)->to_email_mime->as_string' foo.msg > bar.eml

How you can help reduce node_modules bloat

This recent reddit thread reveals discontent among the web development community about the sheer volume of stuff in a typical node_modules dir. 140MB in this case!

Is it a design flaw in npm?

Opinions in the thread varied from "I'm surprised npm even works" to "everything is fine". I'm not going to offer an opinion, just these two observations:

  1. node_modules dirs typically do contain lots of stuff that doesn't need to be there.
  2. The latest version mitigates overall size by flattening the dependency tree, but some of the bloat is beyond npm's control.
# Basic Strongswan ikev2 server setup
* paltform: atlantic.net ubuntu 14.04 x64
* the commands below are run with root account
## Strongswan
```
apt-get install strongswan
apt-get install iptables iptables-persistent
```
@shamil
shamil / mount_qcow2.md
Last active July 18, 2024 15:23
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@kimus
kimus / ufw.md
Created March 2, 2014 22:46
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

@yyuu
yyuu / snakeoil.sh
Created December 19, 2012 07:23
Generate snakeoil SSL certificates on Debian
sudo apt-get install ssl-cert
sudo make-ssl-cert generate-default-snakeoil
sudo usermod --append --groups ssl-cert yyuu
ls -l /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/private/ssl-cert-snakeoil.key
@mebens
mebens / gist:3991990
Created November 1, 2012 05:12
Calculate 8-axis movement angle with LÖVE and ammo-input
-- returns nil if there's no movement
function getDirection()
local xAxis = input.axisDown("left", "right")
local yAxis = input.axisDown("up", "down")
local xAngle = xAxis == 1 and 0 or (xAxis == -1 and math.tau / 2 or nil)
local yAngle = yAxis == 1 and math.tau / 4 or (yAxis == -1 and math.tau * 0.75 or nil)
if xAngle and yAngle then
-- x = 1, y = -1 is a special case the doesn't fit; not sure what I can do about it other than this:
if xAxis == 1 and yAxis == -1 then return yAngle + math.tau / 8 end