Skip to content

Instantly share code, notes, and snippets.

View jaamo's full-sized avatar

Jaakko Alajoki jaamo

View GitHub Profile
@jaamo
jaamo / tls-check.sh
Created February 6, 2023 13:46
Check that TLS 1.1 is not supported on a website
#!/bin/bash
SITES=("https://www.kampiapina.com" "https://apina.studio")
for i in "${SITES[@]}"
do
# Ask file with old version of TLS. Should return an error.
curl $i --verbose --tlsv1.1 --tls-max 1.1 &> response.txt
@jaamo
jaamo / web-servers.md
Last active October 15, 2017 19:08 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
from random import randint
firstNames = ['Kalle', 'Lahna', 'Irma', 'Pekka', 'Jouko', 'Antti', 'Jaakko', 'Jalmari', 'Vihtori', 'Albert', 'Gandalf', 'Iron', 'Batman', 'Sandman']
lastNamesPart1 = ['Virta', 'Kahvi', 'Kala', 'Järvi', 'Niemi', 'Banaani', 'Laku', 'Kilpi', 'Sammakko', 'Pieru', 'Kakka', 'Lehmä', 'Räkä', 'Lima', 'Klöntti', 'Lanta', 'Lemu', 'Löyhkä', 'Yrjö', 'Vaippa', 'Sipuli', 'Kalja', 'Öljy']
lastNamesPart2 = ['nen', 'joki', 'kulma', 'järvi', 'kylä', 'kuisma', 'salo', 'lahti', 'tunkio', 'kasa', 'läjä', 'hiki', 'korva', 'nöyhtä', 'huuli']
def pickWord(words):
return words[randint(0, len(words) - 1)]
def generateName():
@jaamo
jaamo / evermade-clan.markdown
Created December 31, 2016 10:13
Evermade Clan
#!/bin/bash
# Simple mysqld start script for containers
# We do not use mysqld_safe
# Variables
MYSQLD=mysqld
LOG_MESSAGE="Docker startscript: "
wsrep_recover_position=
@jaamo
jaamo / gist:7e0ca58c19fe390a8ff354f874a5b603
Created November 10, 2016 07:47
Nginx: document root based on client's ip address
# Set the default path
set $root /var/www/html/dist;
# Change the document root path based on user's ip address
if ($remote_addr ~ "^(71\.134\.111\.38)$") {
set $root /var/www/html/dist1;
}
# Set config
root $root;
@jaamo
jaamo / gist:c67fe4ee82e1514bedb4b5731a99b158
Last active November 14, 2016 12:32
Linux: Generate File of a certain size
# OS X
dd if=/dev/zero of=output.dat bs=24m count=1
# Linux
dd if=/dev/zero of=output.dat bs=24M count=1
# Add some content to the file.
perl -e 'print "x" x (1024*1024*120)' > test-120MB.jpg
#
# Re-encode file
#
# -i input file
# -b:v video bitrate
# -c:v codec
# -r framerate
# -y overwrite output file
# -t limit time
# -s target size
@jaamo
jaamo / dockerbash
Created April 26, 2016 07:18
Shortcut to execute docker exec -it ID bash
#!/bin/bash
# Print out a list of docker containers.
i=0
firstrun=0
while read x
do
if [ $firstrun == 0 ]
then
echo "$x"
@jaamo
jaamo / 0_reuse_code.js
Created March 10, 2016 12:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console