Quantcast
Channel: programming – silveira neto
Browsing latest articles
Browse All 19 View Live

Image may be NSFW.
Clik here to view.

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 Article



parallel 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 Article

Cedilha 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 Article

2 unit tests, 0 integration tests

Found on reddit

View Article

Python: 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 Article


flatten 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 Article

Ruby 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 Article

Check all checkboxes in a page JavaScript snippet

Array.from(document.getElementsByTagName("input")) .filter( input => { return input.type==="checkbox" } ) .map( checkbox => { checkbox.checked = true })

View Article


Image may be NSFW.
Clik here to view.

conditional 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 Article


ffmpeg 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
Browsing latest articles
Browse All 19 View Live




Latest Images