Add this file to your AI assistant's system prompt or context to help it avoid common AI writing patterns. Source: tropes.fyi by ossama.is
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
| #!/bin/bash | |
| # args: browser | |
| # example: ./getOpenTabs.sh "Brave Browser" | |
| # credits: | |
| # https://gist.github.com/samyk/65c12468686707b388ec43710430a421 | |
| # TODO: | |
| # validate args | |
| # don't open app if not already open |
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
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "net" | |
| "os" | |
| "strings" |
Create a FlameGraph to visualize where your code is spending its time.
Requires plop and FlameGraph.
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. Place in ~/Library/Scripts and enable the Applescript menu via the Applescript Editor | |
| -- (Or export to .app to run from spotlight.) | |
| -- 2. Substitute "vpn.example.com" and "redacted" for your VPN server and password | |
| -- 3. Open Security & Privacy System Preferences, go to Privacy, Accessibility | |
| -- 4. Enable Applescript Editor and System UI Server (or for this .app if so exported) | |
| -- 5. Trigger script from the menu (or run from spotlight) | |
| -- 6. Enjoy being connected | |
| -- 7. Run script again to close connection | |
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 clone https://github.com/twitter/scalding.git | |
| cd scalding | |
| ./sbt scalding-repl/console | |
| */ | |
| import scala.io.Source | |
| val alice = Source.fromURL("http://www.gutenberg.org/files/11/11.txt").getLines | |
| // Add the line numbers, which we might want later | |
| val aliceLineNum = alice.zipWithIndex.toList |
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 python | |
| # encoding: utf-8 | |
| # File Transfer for Pythonista | |
| # ============================ | |
| # This script allows you to transfer Python files from | |
| # and to Pythonista via local Wifi. | |
| # It starts a basic HTTP server that you can access | |
| # as a web page from your browser. | |
| # When you upload a file that already exists, it is |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
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
| package mapreduce | |
| /** | |
| * This is an attempt to find a minimal set of type classes that describe the map-reduce programming model | |
| * (the underlying model of Google map/reduce, Hadoop, Spark and others) | |
| * The idea is to have: | |
| * 1) lawful types that fully constrain correctness | |
| * 2) a minimal set of laws (i.e. we can't remove any laws, | |
| * 3) able to fully express existing map/reduce in terms of these types | |
| * |
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
| #!/bin/bash | |
| # restart-cm-service.sh | |
| # Restart a Cloudera-Manager-managed service via the REST API | |
| # ----------------------------------------------------------------------- | |
| # Copyright (C) 2014 Cloudera and Ben White | |
| # Cloudera Manager credentials | |
| USERNAME=admin | |
| PASSWORD=admin |
NewerOlder