Skip to content

Instantly share code, notes, and snippets.

View akishaha's full-sized avatar

Akshay Shaha akishaha

  • LTIMindtree
  • Pune, India
  • 23:10 (UTC +05:30)
  • X @aki_shaha
View GitHub Profile
@marcduiker
marcduiker / ffmpeg_video_for_twitter.md
Last active April 7, 2024 19:35
FFmpeg command for creating video for Twitter

Convert pngs to mp4

This FFmpeg command reads images named frame_[4 char digit].png and converts it to an mp4 using the h264 encoding which Twitter accepts. The bitrate is set to 5M to reduce blocking as much as possible while keeping the size small.

ffmpeg -framerate 10 -i frame_%04d.png -c:v h264_qsv -b:v 5M video.mp4

Convert and scale an existing mp4 to 1080:

ffmpeg -i input.mp4 -c:v h264_qsv -vf: scale=1080:-1 -b:v 5M output.mp4

<policies>
<inbound>
<set-backend-service base-url="*** add your wcf relay address here ***" />
<cache-lookup-value key="@("relaytoken")" variable-name="relaytoken" />
<choose>
<when condition="@(!context.Variables.ContainsKey("relaytoken"))">
<set-variable name="resourceUri" value="@(context.Request.Url.ToString())" />
<!-- an accessKey entry must exist in NameValue -->
<set-variable name="accessKey" value="{{accessKey}}" />
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 4, 2024 11:33
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@eguven
eguven / brew-list.sh
Last active February 7, 2024 06:16
List all packages installed using Homebrew and their sizes
brew list --formula | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD