Skip to content

Instantly share code, notes, and snippets.

View calvinmorett's full-sized avatar
🎨
Save as...

Calvin calvinmorett

🎨
Save as...
View GitHub Profile
# 10_basic.py
# 15_make_soup.py
# 20_search.py
# 25_navigation.py
# 30_edit.py
# 40_encoding.py
# 50_parse_only_part.py
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active July 16, 2024 15:33
Vanilla JavaScript Quick Reference / Cheatsheet
@yoki
yoki / find_replace.py
Last active December 10, 2022 05:17
Python String
s.index(s2, i, j) #Index of first occurrence of s2 in s after index i and before index j
s.find(s2) #Find and return lowest index of s2 in s
s.index(s2) #Return lowest index of s2 in s (but raise ValueError if not found)
s.replace(s2, s3) #Replace s2 with s3 in s
s.replace(s2, s3, count) #Replace s2 with s3 in s at most count times
s.rfind(s2) #Return highest index of s2 in s
s.rindex(s2) #Return highest index of s2 in s (raise ValueError if not found)
#===================================================
#Regexp
<html>
<head>
<title>Site Title</title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<meta name="keywords" content="">
<meta property="og:title" content="" />
<meta property="og:type" content="" />
@fijimunkii
fijimunkii / log-image.js
Created October 18, 2014 03:18
console.log a gif (from cssconf.eu)
console.log("%c+","font-size: 1px; padding: 180px 320px; line-height: 360px; background: url(http://i.imgur.com/kZfvHRV.gif); background-size: 640px 360px; color: transparent;");
#EXTM3U
#EXTINF:-1,BBC - Radio 1
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p
#EXTINF:-1,BBC - Radio 2
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio2_mf_p
#EXTINF:-1,BBC - Radio 3
http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-aac-lc-a/format/pls/vpid/bbc_radio_three.pls
#EXTINF:-1,BBC - Radio 4
http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio4fm_mf_p
#EXTINF:-1,BBC - Radio 5 live
@vunb
vunb / ffmpeg-convert-mp3-to-wave
Created November 7, 2013 04:52
Convert mp3 to wave format using ffmpeg
ffmpeg -i input.mp3 -acodec pcm_s16le -ac 1 -ar 16000 output.wav
# To convert all mp3 files in a directory in Linux:
for f in *.mp3; do ffmpeg -i "$f" -acodec pcm_s16le -ac 1 -ar 16000 "${f%.mp3}.wav"; done
# Or Windows:
for /r %i in (*) do ffmpeg -i %i -acodec pcm_s16le -ac 1 -ar 16000 %i.wav
@riywo
riywo / gist:5023060
Created February 24, 2013 07:58
Join mp3 files with homebrew
$ brew install -v mp3wrap ffmpeg id3lib
$ mp3wrap tmp.mp3 1.mp3 2.mp3 3.mp3 ....
$ ffmpeg -i tmp_MP3WRAP.mp3 -acodec copy all.mp3 && rm tmp_MP3WRAP.mp3
$ id3cp 1.mp3 all.mp3
@lsauer
lsauer / gist:4086997
Created November 16, 2012 12:35
mp3 Joiner / Join mp3 files
#easy method of joining two mp3's [lsauer.com 2012 - lo sauer]
#the result is dirty since it contains the mp3 header and ID-tags, but most mp3 libs play these files without a hassle.
#use the resulting mp3 as input for AAC, Opus,.. conversion.
#Windows
type file1 file2 > outfile
copy /b file1 + file2 + ... file_n outfile
#Linux, Mac
cat file1 file2 > outfile
@jasny
jasny / linkify.php
Last active May 26, 2024 20:40
PHP function to turn all URLs in clickable links
<?php
/**
* Turn all URLs in clickable links.
*
* @param string $value
* @param array $protocols http/https, ftp, mail, twitter
* @param array $attributes
* @return string
*/
public function linkify($value, $protocols = array('http', 'mail'), array $attributes = array())