Skip to content

Instantly share code, notes, and snippets.

View dryliketoast's full-sized avatar

Michael Kane dryliketoast

View GitHub Profile

Keybase proof

I hereby claim:

  • I am dryliketoast on github.
  • I am dryliketoast (https://keybase.io/dryliketoast) on keybase.
  • I have a public key ASBNENxIg6zaeZX0VOh3AgZ_5Wom-ofzTizvmBgR1I8HnAo

To claim this, I am signing this object:

@dryliketoast
dryliketoast / passwd.php
Created June 25, 2017 23:08
Brute force password list generator
<?PHP
$keys = "0 1 2 3 4 5 7 8 9 a b c d e f";
$keys = explode(' ', $keys);
$length = 8;
echo loop($length,$keys);
function loop($length,$keys,$depth=1,$buffer='')
https://bbs.archlinux.org/viewtopic.php?id=87176
Set DPI to 96 in Xorg.conf:
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
#!/bin/bash
#
# src: https://www.iplocation.net/traffic-control
#
# tc uses the following units when passed as a parameter.
# kbps: Kilobytes per second
# mbps: Megabytes per second
# kbit: Kilobits per second
# mbit: Megabits per second
# bps: Bytes per second
PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned
PS C:\WINDOWS\system32> $UserCredential = Get-Credential
PS C:\WINDOWS\system32> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
PS C:\WINDOWS\system32> Import-PSSession $Session
PS C:\WINDOWS\system32> New-DistributionGroup -PrimarySmtpAddress {distro_email_address} -Name "{my distro group}" -Members {list_of_recipients_email_addresses,comma,separated}
Written by Thanos Apostolou
http://askubuntu.com/questions/53822/how-do-you-run-ubuntu-server-with-a-gui
Some more info can be found here https://help.ubuntu.com/community/ServerGUI. I assume you start with a clean install of Ubuntu Server 16.04 (some modifications may be needed for older versions of Ubuntu). Depending on your needs you can do these:
Minimal GUI:
sudo apt install xorg
sudo apt install --no-install-recommends openbox
Run the command startx and openbox will start (you can open a terminal there and run any application you want)
Keybindings
C-a tab - switch input focus to the next region.
C-a Q - remove all regions but the current one.
C-a S - split the current region horizontally into two new regions.
C-a X - remove the current region.
C-a | - split the current region vertically into two new regions.
Focusing Regions
The focus command is relatively simplistic. Even though regions may be laid out in a two-dimensional space, screen maintains them internally as a simple list, and focus simply moves forwards or backwards through the list. (There are also focus subcommands to jump to the beginning of the list–the upper-leftmost region–and to the end of the list–the lower rightmost region.) The order is pretty intuitive, and it's easier to tell you to try it out than to try to describe it.
# convert pdf to high resolution image
convert -density 1200 page.pdf -resample 300 page.jpg
Base 36 to Integer:
intval($str,36)
Integer to Base 36:
base_convert($val, 10, 36)
So then, instead of redirecting to a route like /url/1234 it becomes /url/ax instead.
This gives you a whole lot more use than a hash will, as there will be no collisions.
Don't hash, use other bases for this kind of thing. (It's faster and can be made collision-proof.)
@dryliketoast
dryliketoast / gist:7ca004ec77d4e3cd6a21
Last active September 11, 2015 16:26
line returns in bash
With bash, if you want to embed newlines in a string, enclose the string with $'':
$ list="One\ntwo\nthree\nfour"
$ echo "$list"
One\ntwo\nthree\nfour
$ list=$'One\ntwo\nthree\nfour'
$ echo "$list"
One
two
three