Skip to content

Instantly share code, notes, and snippets.

@lucasrizoli
lucasrizoli / gist:1040285
Created Jun 22, 2011
Convert UNIX timestamp to Excel date (in EST timezone)
View gist:1040285
=(((A1/60)/60)/24)+DATE(1970,1,1)+(-5/24)
@lucasrizoli
lucasrizoli / gist:1603274
Created Jan 12, 2012
70 Unique Ways to Encode <
View gist:1603274
<
%3C
&lt
&lt;
&LT
&LT;
&#60
&#060
&#0060
&#00060
@lucasrizoli
lucasrizoli / gist:2024505
Created Mar 12, 2012
Bookmarklet for converting UNIX/POSIX timestamp to date and time
View gist:2024505
javascript:(function(a){var b=parseInt(a.replace(/[\s|,]/g,""),10);alert(isNaN(b)?'"'+a+"\" doesn't look like a UNIX timestamp.":'"'+a+'" is\n'+new Date(b*(b>1e12?1:1e3)));})(window.getSelection().toString());
@lucasrizoli
lucasrizoli / gist:4079640
Created Nov 15, 2012
Solution to FizzBuzz problem
View gist:4079640
/**
* Inspired by http://www.globalnerdy.com/2012/11/15/fizzbuzz-still-works/
*
* Write a program that prints the numbers from 1 to 100, but
* for multiples of 3 print "Fizz" instead of the number and
* for the multiples of 5 print "Buzz." For numbers which are
* multiples of both 3 and 5 print "FizzBuzz."
*/
for( var i = 1; i <= 100; i += 1 ) {
@lucasrizoli
lucasrizoli / gist:4178397
Last active Jul 9, 2018
OS X/PlayStation/Xbox symbols & entity codes
View gist:4178397
Symbol HTML entity Alt entity Alt entity Name
&#8592; &#x2190; &larr; Left Arrow
&#8593; &#x2191; &uarr; Up Arrow
&#8594; &#x2192; &rarr; Right Arrow
&#8595; &#x2193; &darr; Down Arrow
&#8677; &#x21E5; Tab
&#8676; &#x21E4; Back Tab
&#8679; &#x21E7; Shift
&#8682; &#x21EA; Caps Lock
View gist:5511109
var dict = {
"Videogames" : "Things",
"Videogame" : "Thing",
"videogames" : "things",
"videogame" : "thing",
"Games" : "Things",
"Game" : "Thing",
"games" : "things",
"Games" : "Things",
"game" : "thing",
@lucasrizoli
lucasrizoli / gist:5577646
Created May 14, 2013
Factorial functions, one recursive and one iterative Wanted to see if there were any significant differences in performance. http://jsperf.com/factorial-recursive-v-iterative
View gist:5577646
var factorialRecursive = (function () {
// 0! = 1 just 'cause
var factorials = [ 1 ];
return function fFactorial( n ) {
if ( n < 0 ) {
// negative n! not defined
return null;
} else if ( factorials[ n ] ) {
return factorials[ n ];
@lucasrizoli
lucasrizoli / gist:7013194
Last active Dec 25, 2015
regex punctuation class
View gist:7013194
import re
punctexp = re.compile(r"[\!\"\#\$\%\&\\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^_\`\{\|\}\~]")
# Could also…
# import string
# re.compile('[{0}]'.format(re.escape(string.punctuation)))
@lucasrizoli
lucasrizoli / gist:e055bf2c18218ffdcee7
Created Feb 23, 2015
PowerPoint Macro to switch language of document to en-CA
View gist:e055bf2c18218ffdcee7
Option Explicit
Public Sub ChangeSpellCheckingLanguage()
Dim j As Integer, k As Integer, scount As Integer, fcount As Integer
scount = ActivePresentation.Slides.Count
For j = 1 To scount
fcount = ActivePresentation.Slides(j).Shapes.Count
For k = 1 To fcount
If ActivePresentation.Slides(j).Shapes(k).HasTextFrame Then
' List of available LanguageID values at https://msdn.microsoft.com/en-us/library/aa432635.aspx
ActivePresentation.Slides(j).Shapes(k) _
View gist:b034a1913d768ba25f8947a85bda6d89
# Convert input.avi to out.mp4
ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a aac -b:a 192k -ac 2 out.mp4
# Clip using ffmpeg
## no reencode
ffmpeg -i in.mp4 -ss [start] -t [duration] -c copy out.mp4
ffmpeg -i in.mp4 -ss [start] -to [end] -c copy out.mp4
## yes reencode
ffmpeg -ss [start] -i in.mp4 -t [duration] -c:v libx264 -c:a aac -strict experimental -b:a 128k out.mp4
You can’t perform that action at this time.