start new:
tmux
start new with session name:
tmux new -s myname
import inspect | |
def use_strict(func): | |
signature = inspect.signature(func) | |
def validate_args(*args): | |
params = signature.parameters.values() | |
types = map(lambda p: p.annotation, params) | |
zipped = zip(list(*args), types) |
—– BEGIN LICENSE —– | |
Michael Barnes | |
Single User License | |
EA7E-821385 | |
8A353C41 872A0D5C DF9B2950 AFF6F667 | |
C458EA6D 8EA3C286 98D1D650 131A97AB | |
AA919AEC EF20E143 B361B1E7 4C8B7F04 | |
B085E65E 2F5F5360 8489D422 FB8FC1AA | |
93F6323C FD7F7544 3F39C318 D95E6480 | |
FCCC7561 8A4A1741 68FA4223 ADCEDE07 |
@RequestMapping(method = RequestMethod.GET, value = "/{video:.+}") | |
public StreamingResponseBody stream(@PathVariable String video) | |
throws FileNotFoundException { | |
File videoFile = videos.get(video); | |
final InputStream videoFileStream = new FileInputStream(videoFile); | |
return (os) -> { | |
readAndWrite(videoFileStream, os); | |
}; | |
} |
enum class State { STRING, DIGIT } | |
fun stringToStructure(string: String): List<Pair<String, Int>> { | |
val result: MutableList<Pair<String, Int>> = mutableListOf() | |
var previousState = State.STRING | |
var stringAcc = "" | |
var numberAcc = "" | |
fun saveAccumulators() { |
fun <T> List<T>.headTail(): Pair<T, List<T>> = Pair(first(), drop(1)) | |
typealias Result = List<Pair<String, Int>> | |
fun iterString(rest: List<Char>, stringAcc: String, numberAcc: String, acc: Result): Result { | |
if (rest.isEmpty()) { | |
throw IllegalStateException() | |
} | |
val (head, tail) = rest.headTail() | |
if (head.isLetter()) { |
git branch -m old_branch new_branch # Rename branch locally | |
git push origin :old_branch # Delete the old branch | |
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote |
#!/bin/sh | |
cd /var | |
touch swap.img | |
chmod 600 swap.img | |
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000 # 1000MB | |
mkswap /var/swap.img | |
swapon /var/swap.img | |
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab |
// @flow | |
import React from 'react'; | |
const starEmoji = '⭐'; | |
type StarPropsShape = {| score: number |}; | |
const Star = ({ score }: StarPropsShape) => ( | |
<span className="score-star"> | |
{starEmoji.repeat(Math.floor(score))} |
# webm | |
ffmpeg -i IN -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 640x360 OUT.webm | |
# mp4 | |
ffmpeg -i IN -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -vpre slow -f mp4 -crf 22 -s 640x360 OUT.mp4 | |
# ogg (if you want to support older Firefox) | |
ffmpeg2theora IN -o OUT.ogv -x 640 -y 360 --videoquality 5 --audioquality 0 --frontend |