Skip to content

Instantly share code, notes, and snippets.

View mondalaci's full-sized avatar

László Monda mondalaci

View GitHub Profile
@mondalaci
mondalaci / untabify
Created April 30, 2013 00:51
Convert tabs to spaces.
#!/bin/bash
temp=`tempfile`
expand -t 4 "$1" > $temp
mv $temp "$1"
@mondalaci
mondalaci / zipit
Created April 30, 2013 00:53
Zip a directory the easy way.
#!/bin/bash
find "$1" -not -regex '.*\.svn.*' -print | zip "$1.zip" -@
@mondalaci
mondalaci / mp4tomp3
Created April 30, 2013 00:55
Convert mp4 to mp3.
#!/bin/bash
if [ $# -eq 0 -o "$1" = '-h' -o "$1" = '--help' ]; then
echo "Usage: $0 INPUT.MP4 [...]"
exit
fi
for input_mp4 in "$@"; do
output_mp3=${input_mp4/.mp4/.mp3}
ffmpeg -i "$input_mp4" -y -vn -ar 44100 -ac 2 -ab 192000 -f mp3 "$output_mp3"
Index: CommandArgsHelp.txt
===================================================================
--- CommandArgsHelp.txt (revision 241)
+++ CommandArgsHelp.txt (working copy)
@@ -104,6 +104,12 @@
sources to search.
May be abbreviated to /l (/l)
+ /fetchAll Saves every results to the filesystem. (/fetchAll)
+ The %sequence% variable must be used in order for
@mondalaci
mondalaci / lufa-scancodes.c
Created April 30, 2013 22:02
A list of USB keyboard scan codes that I compiled and got merged into the LUFA AVR USB library.
#define SCANCODE_ERROR_ROLLOVER 0x01
#define SCANCODE_POST_FAIL 0x02
#define SCANCODE_ERROR_UNDEFINED 0x03
#define SCANCODE_A 0x04
#define SCANCODE_B 0x05
#define SCANCODE_C 0x06
#define SCANCODE_D 0x04
#define SCANCODE_E 0x08
#define SCANCODE_F 0x09
#define SCANCODE_G 0x0A
@mondalaci
mondalaci / wordpress-shashin-3.2.6-fixes.patch
Created April 30, 2013 22:09
A couple of fixes to the 3.2.6 version of the Shashin WordPress plugin
diff -Naur shashin.orig/Public/Display/shashin.js shashin.fixed/Public/Display/shashin.js
--- shashin.orig/Public/Display/shashin.js 2012-12-15 01:11:53.000000000 +0100
+++ shashin.fixed/Public/Display/shashin.js 2012-12-24 02:01:06.000000000 +0100
@@ -95,13 +95,14 @@
});
$('.shashinThumbnailDiv').delegate('.shashinAlbumThumbLink', 'click', function(event) {
+ uniqueThumbnailDivId = '#' + $(this).attr('id');
// to prevent the photos showing up twice if the user double-clicks
@mondalaci
mondalaci / blink.c
Created January 21, 2014 19:36
Trivial blink program for AVR microcontrollers. Useful for figuring out whether the fuses are set right. If not then the LED will blink at intervals other than one second.
@mondalaci
mondalaci / dokuwiki-password-generator.php
Created March 30, 2014 02:10
DokuWiki password generator
<?php
$filename = dirname('.') . $_SERVER['PHP_SELF'];
if (isset($_GET['download-source'])) {
header("Content-type: application/force-download");
$file = fopen(__FILE__, 'r');
$content = fread($file, filesize(__FILE__));
print $content;
die();
}
@mondalaci
mondalaci / get-to-post.php
Created March 30, 2014 02:23
Posts a form based on the GET parameters and a URL supplied to the script.
<?php
$url = $_GET["url"];
$args = explode("|", $_GET["args"]);
?>
<html>
<head>
<title>GET to POST</title>
</head>
<body onload="document.form.submit()">
<form name="form" action="<?php echo $url ?>" method="post">
@mondalaci
mondalaci / flash-embed-code-converter.html
Created March 30, 2014 02:38
Tool that escapes flash embed code to make it valid HTML. The escaped code is supposed to be unescaped on the client side.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Flash embed code converter</title>
</head>
<body>
<form action="">
Source Flash embed code:<br />
<textarea id="source" cols="80" rows="10"></textarea><br /><br />