This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --pretty=oneline --graph --decorate --all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ffmpeg -f lavfi -i color=c=#00000000:s=440x720 -t 16 -i input.mp4 -shortest -filter_complex "[1:v]chromakey=0x00ff00:0.2:0.2[ckout];[0:v][ckout]overlay[out]" -map "[out]" -shortest output.webm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* TypeScript port by Thilo Planz | |
* | |
* https://gist.github.com/thiloplanz/6abf04f957197e9e3912 | |
*/ | |
/* | |
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace | |
so it's better encapsulated. Now you can have multiple random number generators | |
and they won't stomp all over eachother's state. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20; | |
To search by kilometers instead of miles, replace 3959 with 6371. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# IMPORTANT | |
# First install and run Xcode from Mac App Store | |
# | |
# (Might as well download and setup... Affinity Designer, Trello, | |
# Notability, Wipr, NextDNS, The Unarchiver ...while you're there!) | |
# | |
echo "Oooh, lovely new Mac! Wish you well to use it! Time to install your 'grams..." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Example below shows single-table batch read where the table name is "Posts" and the items in | |
## DynamoDB have a primary key of "id". You can read from multiple tables at once by | |
## specifying each table name under "tables" - e.g. "tables": {"Table1": "...", "Table2": "..."} | |
## Read more: https://docs.aws.amazon.com/appsync/latest/devguide/tutorial-dynamodb-batch.html | |
#set($ids = []) | |
#foreach($stage in ${ctx.source.stages}) | |
#set($map = {}) | |
$util.qr($map.put("id", $util.dynamodb.toString($stage.id))) | |
$util.qr($ids.add($map)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Rule30Demo extends App { | |
val rule30: List[Int] => Int = { | |
case 1 :: 1 :: 1 :: Nil => 0 | |
case 1 :: 1 :: 0 :: Nil => 0 | |
case 1 :: 0 :: 1 :: Nil => 0 | |
case 1 :: 0 :: 0 :: Nil => 1 | |
case 0 :: 1 :: 1 :: Nil => 1 | |
case 0 :: 1 :: 0 :: Nil => 1 | |
case 0 :: 0 :: 1 :: Nil => 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Node(value: String, left: Option[Node], right: Option[Node]) | |
val tree = Node("Sarah", | |
Some(Node("Fred", Some(Node("Hilary", None, None)), Some(Node("Jenny", Some(Node("James", None, None)), None)))), | |
None) | |
def checkChildrenContains(name: String, n: Node): Boolean = { | |
val leftContains = n.left match { | |
case Some(node) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val codes = List( | |
List("C","T","E","W","H","H","Y","T","K","F","X","T"), //"T","P", | |
List("C","T","Y","X","H","E","T","C","C","F","X","W"), //"T","P", | |
List("C","T","C","H","W","X","W","F","C","P","K","P"), //"T","P", | |
List("E","K","C","P","X","P","E","Y","K","E","W","F"), //"P","T", | |
List("E","P","E","H","H","H","Y","P","X","W","E","H"), //"P","T", | |
List("E","P","F","K","K","X","C","P","W","X","E","C"), //"P","T", | |
List("E","T","E","W","C","E","W","E","K","T","E","W"), //"P","T", | |
List("E","K","Y","E","X","C","T","F","F","K","K","W"), //"P","T", | |
List("E","P","E","C","Y","P","X","T","K","T","X","F"), //"P","T", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(1 to 100).map( i => (i % 3, i % 5) match { | |
case (0, 0) => "FizzBuzz" | |
case (0, _) => "Fizz" | |
case (_, 0) => "Buzz" | |
case _ => i | |
}).foreach(println) |
NewerOlder