Skip to content

Instantly share code, notes, and snippets.

View daxxog's full-sized avatar

David Volm daxxog

View GitHub Profile
@Synchro
Synchro / gist:1139429
Created August 11, 2011 11:29
PHP Base-62 encoder/decoder
<?php
/**
* This is an example of a practical encoder and decoder for base-62 data in PHP
* It differs from the majority of examples in that it's fast enough for moderate data sizes, unlike multiprecision converters
* To be practical, base-62 encoding needs to use internal chunking and padding because base-62 does not fit exactly into any integral number of bits
* This means the output is not quite compatible with multiprecision conversions,
* but the encoded data retains all the desirable properties of base-62, so (unlike any base-64 encoding) it's URL, DNS, email address and pathname safe
* @author Marcus Bointon <marcus@synchromedia.co.uk>
* @copyright 2011 Marcus Bointon
* @license http://www.opensource.org/licenses/mit-license.html MIT License
@solenoid
solenoid / gist:1372386
Created November 17, 2011 04:49
javascript ObjectId generator
var mongoObjectId = function () {
var timestamp = (new Date().getTime() / 1000 | 0).toString(16);
return timestamp + 'xxxxxxxxxxxxxxxx'.replace(/[x]/g, function() {
return (Math.random() * 16 | 0).toString(16);
}).toLowerCase();
};
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 24, 2024 17:56
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@shawnbot
shawnbot / xterm-256color.md
Last active March 22, 2024 16:26
Make OS X Terminal respect 256 colors in screen

1. Ensure that Terminal declares itself as "xterm-256color"

Under Terminal > Preferences... > (Profile) > Advanced, "Declare terminal as:" should be set to xterm-256color.

2. Build a version of screen that supports 256 colors

This is easy with homebrew:

brew install screen
@tiernano
tiernano / gist:4344701
Created December 20, 2012 11:08
IPv6 Firewall rules for a MikroTik router to allow outgoing connections, but block incoming, unless they are responses...
/ipv6 firewall filter
add action=accept chain=input comment="Allow established connections" connection-state=established disabled=no
add action=accept chain=input comment="Allow related connections" connection-state=related disabled=no
add action=accept chain=input comment="Allow limited ICMP" disabled=no limit=50/5s,5 protocol=icmpv6
add action=accept chain=input comment="Allow UDP" disabled=no protocol=udp
add action=drop chain=input comment="" disabled=no
add action=accept chain=forward comment="Allow any to internet" disabled=no out-interface=sit1
add action=accept chain=forward comment="Allow established connections" connection-state=established disabled=no
add action=accept chain=forward comment="Allow related connections" connection-state=related disabled=no
add action=drop chain=forward comment="" disabled=no
@daxxog
daxxog / all-tools--shortcuts-install.sh
Last active June 20, 2019 19:31
install all my tools and shortcuts
#!/bin/sh
#sudo apt-get install -y curl
#curl -L tinyurl.com/dxgshortcuts | sh
sudo apt-get install -y git
curl https://gist.githubusercontent.com/daxxog/615fae60e1974828e865/raw/rmr-dg-clone-install.sh | sh
curl https://gist.githubusercontent.com/daxxog/202792236c0a21339ab4/raw/install-git-shortcuts.sh | sh
curl https://gist.githubusercontent.com/daxxog/cfb990f5cbe6805c0cf7/raw/uid-gid-install.sh | sh
curl https://gist.githubusercontent.com/daxxog/8d9895d01f4f1ffea1a1/raw/pushbranch-install.sh | sh
@Brainiarc7
Brainiarc7 / fstab-generate-arch.md
Last active July 23, 2024 16:07
Generate fstab in Arch Linux

First, install arch-install-scripts:

sudo pacman -S --needed arch-install-scripts

Secondly, mount your partitions in all the internal hard drives.

Thirdly, generate and validate your config by piping it out to stdout:

@rponte
rponte / get-latest-tag-on-git.sh
Last active July 4, 2024 10:55
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@daxxog
daxxog / clambuntu.sh
Last active June 24, 2019 18:17
install clam on Ubuntu 18.10
#!/bin/bash
#curl -L https://gist.githubusercontent.com/daxxog/a2f5db9cbe5fd02770764ba183dc6504/raw/clambuntu.sh | sh
sudo /etc/init.d/clamd stop
cd ~
mkdir dev
cd dev
CLAMVERSION=1.4.17
rm -rf "clam-$CLAMVERSION/"
curl -L "https://github.com/nochowderforyou/clams/releases/download/v$CLAMVERSION/clam-$CLAMVERSION-linux64.tar.gz" | tar xvz
@daxxog
daxxog / sshvncaio.sh
Last active August 16, 2019 16:18
All in one script to config ssh and vnc for a local env.
#!/bin/bash
#sudo apt install -y curl
#curl -L tinyurl.com/ssh-0-dxg | sh
#curl -L tinyurl.com/dxg-0-ssh | sh
sudo apt update
sudo apt install -y openssh-server tightvncserver autocutsel openbox-lxde-session net-tools
#sshin config
curl -L bit.ly/29v2OyX | sh