Skip to content

Instantly share code, notes, and snippets.

Marcus Kazmierczak mkaz

Block or report user

Report or block mkaz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mkaz
mkaz / ffmpeg.sh
Last active Aug 15, 2019
ffmpeg commands
View ffmpeg.sh
# convert to 720p
ffmpeg -i input.mp4 -preset slow -codec:a aac -b:a 128k -codec:v libx264 -pix_fmt yuv420p -b:v 2500k -minrate 1500k -maxrate 4000k -bufsize 5000k -vf scale=-1:720 output.mp4
# slice video
# --ss : start from seconds from begining
# -t : time duration of clip
$ ffmpeg -i input.mp4 -ss 30 -t 10 output.mp4
# convert movie to gif
# first create palette.png
@mkaz
mkaz / prime-numbers-1.py
Last active Apr 23, 2019
The Sieve of Eratosthenes - Find primes in Python, Golang, and C
View prime-numbers-1.py
#!/usr/bin/env python3
import os, string
max = 1000000
# seed list with first two primes
primes = [2,3]
# set number
start_num = 4
@mkaz
mkaz / in-space.py
Created Feb 25, 2019
People currently in Space
View in-space.py
#!/usr/bin/env python3
""" How many people currently in space """
import json, requests, sys
response = requests.get('http://api.open-notify.org/astros.json')
data = response.json()
print(data["number"])
sys.exit(0)
@mkaz
mkaz / btc.py
Created Feb 25, 2019
Script to fetch current bitcoin price
View btc.py
#!/usr/bin/env python3
""" Current Bitcoin price """
import requests
import json
import sys
apiurl = 'https://api.coindesk.com/v1/bpi/currentprice.json'
response = requests.get(apiurl)
@mkaz
mkaz / unix-crontab.md
Last active May 29, 2019
Unix Crontab
View unix-crontab.md

Unix Crontab

Introduction

cron is a utility that you can use to schedule and automate tasks. By defining items in the cron table, called crontab, you can schedule any script or program to run on almost any sort of schedule. For example, Research [Flagship Merchant Services][1] on Thursday at 6:30pm.

For example, run a [program][2] each day 5 minutes after midnight on mondays, wednesdays and fridays. Or schedule something to run every five minutes, or once a month.

Basics

View 10-scala-one-liners-to-impress-your-friends.md

10 Scala One Liners to Impress Your Friends

Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.

Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.

1. Multiple Each Item in a List by 2

The map function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o

View wpcom-set-featured-images.py
View get-posts-no-imgs.php
<?php
// Outputs list of post ids and url for first image in post
// This script gathers data for images not already uploaded to WP
// Quick Usage
// 1. copy script and lib below to your WP directory
// 2. install wp-cli from: http://wp-cli.org
// 3. Run script: wp eval-file get-posts-no-imgs.php >posts-data.txt
View set-featured-image.php
@mkaz
mkaz / keybase.md
Created Jul 14, 2014
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am mkaz on github.
  • I am mkaz (https://keybase.io/mkaz) on keybase.
  • I have a public key whose fingerprint is E4E8 4E24 A94F A670 39A5 F6A7 E82A EA62 82C4 BC5F

To claim this, I am signing this object:

You can’t perform that action at this time.