Regex with negatives lookahead and lookbehind
“Looking different directions” by Paul Kline. Problem: Match strings that contains a single quotation mark ('), but not multiple ones together. Solution: (?<!')'(?!') This is a regex for a single...
View Articleparallel counting in Java using AtomicInteger
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.TimeUnit; class ParallelCounterExample...
View ArticleCedilha no Ubuntu 16.04
çççç ççç ççç ççç ççç ççç ççç ççç ççç çççç çç çç Fiz esse script (cedilha.sh) pra fazer o c-cedilha (ç) funcionar no Ubuntu 16.04. Como é uma tarefa chata que eu já tive que fazer muitas vezes fica...
View ArticlePython: Getting page title
# Get the HTML page content from urllib import request html = request.urlopen("https://silveiraneto.net").read() # Get the title tag from bs4 import BeautifulSoup title = BeautifulSoup(html,...
View Articleflatten directory structure
Move files in current subdirectories to the current directory. find . -mindepth 2 -type f -exec mv -t . -i '{}' + Delete local folders that are empty. find . -empty -type d -delete
View ArticleRuby super
class A def foo [1, 2, 3] end end class B < A def foo super.map{ |n| n * 2 } end end puts A.new.foo.to_s puts B.new.foo.to_s Output [1, 2, 3] [2, 4, 6]
View ArticleCheck all checkboxes in a page JavaScript snippet
Array.from(document.getElementsByTagName("input")) .filter( input => { return input.type==="checkbox" } ) .map( checkbox => { checkbox.checked = true })
View Articleconditional past, present, future in spreadsheets/Excel
=IF(B2=TODAY(),"Past",IF(B2<TODAY(),"Today",TEXT(B2,"ddd"))) Given a column B that contains dates in a sequential order. Shows a “Today” when it’s today. Shows a “Past” when is past. Shows an...
View Articleffmpeg video to png and png to video
ffmpeg -i original.mp4 -vf fps=25 out%04d.png ffmpeg -framerate 25 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p out.mp4
View Article
More Pages to Explore .....