This file contains 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
Game { | |
height: 3; | |
width: 50%; | |
} |
This file contains 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
from textual.app import App, ComposeResult | |
from textual.containers import Container | |
from textual.reactive import reactive | |
from textual.widgets import Static | |
class Thing(Static): | |
def __init__( self, text ) -> None: | |
self._text = text | |
super().__init__() |
This file contains 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
USER='admin' | |
PASS='admin' | |
CLUSTER='dev' | |
HOST=$(hostname -f):8080 | |
function start(){ | |
curl -u $USER:$PASS -i -H 'X-Requested-By: ambari' -X PUT -d \ | |
'{"RequestInfo": {"context" :"Start '"$1"' via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' \ | |
http://$HOST/api/v1/clusters/$CLUSTER/services/$1 | |
} |
This file contains 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
%angular | |
<input id="textbox" class="hide" ng-model="someAngularVar"></input> | |
<button id="btn" type="submit" onclick="update()">UpperCase It!</button> | |
<script type="text/javascript"> | |
function update(){ | |
var element = $('#textbox'); | |
var currentVal = element.val(); | |
//Update the value | |
element.val(currentVal.toUpperCase()); |
This file contains 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
# determines whether a GPU is available in your instance and starts an appropriate Dask Cluster | |
from dask.distributed import Client, LocalCluster | |
from dask_cuda import LocalCUDACluster | |
from dask_sql import Context | |
from pyngrok import ngrok | |
import dask | |
import time | |
import warnings | |
from IPython.core.magic import needs_local_scope, register_cell_magic |
This file contains 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
import jaydebeapi | |
conn = jaydebeapi.connect('org.apache.phoenix.jdbc.PhoenixDriver', \ | |
['jdbc:phoenix:my_zk_server:2181:/hbase-unsecure', '', ''], \ | |
'/usr/hdp/current/phoenix-client/phoenix-client.jar') | |
curs = conn.cursor() | |
curs.execute('select * from WEB_STAT limit 1') | |
curs.fetchall() |
This file contains 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
from IPython.core.magic import register_cell_magic, needs_local_scope | |
from sql_formatter.core import format_sql | |
import time, warnings | |
warnings.filterwarnings("ignore") | |
@register_cell_magic | |
@needs_local_scope | |
def sql(line, cell, local_ns): | |
sql_statement = cell.format(**local_ns) |
This file contains 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
df = spark.createDataFrame( | |
[ | |
(1, 'foo'), # create your data here, be consistent in the types. | |
(2, 'bar'), | |
], | |
['id', 'txt'] # add your columns label here | |
) | |
df.write.csv('test') | |
spark.read.csv('test').collect() |
This file contains 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
# Put a list of URLs in a file, inputs.txt | |
echo ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/2009.csv.gz > input.txt | |
echo ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/by_year/2010.csv.gz >> input.txt | |
# Trick to force MapReduce to treat each line in inputs.txt as a single map task | |
mkdir input | |
cd input | |
# I used 1 line per file - tweak for smaller downloads & fewer map tasks | |
split -l 1 ../input.txt | |
hadoop fs -put input . |
This file contains 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
# See https://pip.pypa.io/en/latest/installing.html for how to install pip, then: | |
# pip install simple-salesforce | |
from simple_salesforce import Salesforce | |
import string | |
# To get your SFDC token, see https://help.salesforce.com/apex/HTViewHelpDoc?id=user_security_token.htm | |
# salesforce_login.txt should contain the following, one per line: | |
# Your Name | |
# your_email@sfdc_account.com | |
# your_password |
NewerOlder