Skip to content

Instantly share code, notes, and snippets.

@NapoleonWils0n
NapoleonWils0n / base64url.php
Created Nov 3, 2012
php: base64 encode image by url
View base64url.php
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Semantic html 5</title>
</head>
<body>
<img src="data:image/jpg;base64,<?php echo base64_encode(file_get_contents("image.jpg")) ?>" height="19" width="78" alt="base64" />
@NapoleonWils0n
NapoleonWils0n / MPlayer play files recursively in a directory.txt
Created Nov 11, 2012
mplayer: play files recursively in a directory
View MPlayer play files recursively in a directory.txt
MPlayer play files recursively in a directory.
I wanted to have my files played in alphabetical order and only avi files (since a couple .srt subtitle files were in there…), so I came up with this :
mplayer -playlist <(find "$PWD" -name "*.avi" -type f | sort)
View sed_commands.sh
#!/bin/sh
# ============================
# = Editing Files with 'sed' =
# ============================
# 'sed' stands for Stream EDitor and is used to edit files automatically. It reads a file line by line, edits each line as directed by a
# list of commands, and spits out the changed line. 'sed' does a lot, much more than I can cover in this tutorial. A fuller tutorial on
# 'sed' will appear in an Advanced Lesson.
#
@NapoleonWils0n
NapoleonWils0n / Apache_rewrite_to_Amazon_S3.txt
Created Nov 2, 2012
apache: apache rewrite to amazon s3 bucket
View Apache_rewrite_to_Amazon_S3.txt
<Directory "/www/sitename/folder/">
<IfModule mod_rewrite.c>
RewriteEngine ON
RewriteRule ^(.*) http://bucktname.s3.amazonaws.com/folder/$1
</IfModule>
</Directory>
View curl_test_gzip_times.sh
#!/bin/sh
# ========================
# = curl test gzip times =
# ========================
# Time with Gzip:
curl http://www.example.com --silent -H "Accept-Encoding: gzip,deflate" --write-out "time_total=%{time_total}\n" --output /dev/null
View ssh_relay_server.sh
#!/bin/sh
#-----------------------------------------------------------#
# ssh relay server #
#-----------------------------------------------------------#
# use a ssh server a middle man
# to connect 2 computers behind firewalls
@NapoleonWils0n
NapoleonWils0n / ffmpeg combine files.sh
Created Nov 4, 2012
ffmpeg: combine seperate audio and video files into a single video
View ffmpeg combine files.sh
#!/bin/sh
# ffmpeg combine seperate audio and video files into a single video
# copy the audio and video tracks
ffmpeg -i audio.aiff -i video.mov -acodec copy -vcodec copy -f mp4 avcombined.mp4
# encode the audio as aac and copy the video track without encoding it. if its the h264 codec
ffmpeg -i audio.aiff -i video.mov -acodec libfaac -ac 2 -ar 48000 -ab 160k -vcodec copy -f mp4 avcombined.mp4
@NapoleonWils0n
NapoleonWils0n / install google chrome on debian.sh
Created Nov 3, 2012
linux: install google chrome on debian
View install google chrome on debian.sh
#!/bin/sh
# install google chrome on debian
# download google chrome
# install the deb file
sudo dpkg -i google-chrome-stable_current_i386.deb
# you need to install libcurl3
@NapoleonWils0n
NapoleonWils0n / mysql linux install.sh
Created Nov 3, 2012
linux: mysql install and set up
View mysql linux install.sh
#!/bin/sh
# =======================
# = MySQL linux install =
# =======================
# To begin with, a simple MySQL install:
@NapoleonWils0n
NapoleonWils0n / oathtool totp google 2 factor example.txt
Created Nov 3, 2012
macosx: oathtool totp google 2 factor authentication
View oathtool totp google 2 factor example.txt
#-----------------------------------------------#
# oathtool totp google 2 factor
#-----------------------------------------------#
# if you have already set up 2 factor authentication with your phone
# you need to remove it from your phone and google authenticator app
# this wont invalidate your backup codes or application codes
# login to your google account go to 2 factor authentication,