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
SHOW search_path; | |
SET search_path TO your_schema; |
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
// change .views to .tables for tables | |
SELECT | |
sys.columns.name AS ColumnName, | |
views.name AS TableName | |
FROM | |
sys.columns | |
JOIN sys.views ON | |
sys.columns.object_id = views.object_id | |
WHERE | |
sys.columns.name = 'YOUR_COLUMN'; |
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
(group as text, dataset as text, token as text) => | |
let | |
Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/", | |
[ | |
RelativePath = "/groups/" & group & "/datasets/" & dataset & "/refreshes", | |
Headers=[Authorization="Bearer " & token] | |
] | |
)), | |
value = Source[value] |
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
(group as text, token as text) => | |
let | |
Source = Json.Document(Web.Contents("https://api.powerbi.com/v1.0/myorg/", | |
[ | |
RelativePath = "/groups/" & group & "/datasets", | |
Headers=[Authorization="Bearer " & token] | |
] | |
)), | |
value = Source[value] |
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
npm ls -g --depth 0 |
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
# Add these to ~/.bash_profile, adding to ~/.bashrc won't work if you use brew to install pyenv | |
export PATH="$HOME/.pyenv/bin:$PATH" | |
eval "$(pyenv init -)" |
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. Download raspberry pi image on your SD card. | |
2. Create a ssh file with empty content. | |
3. Create wpa_supplicant.conf file with the content below: | |
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev | |
update_config=1 | |
country=<Insert 2 letter ISO 3166-1 country code here> | |
network={ | |
ssid="<Name of your wireless LAN>" |
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
# map(), filter(), reduce() apply a function to every element in what you pass in | |
def add(a): | |
return a + 10 | |
arr = [1,2,3] | |
print(map(add, arr)) # returns 11, 12, 13 | |
def gt_two(a): | |
return a > 2 | |
print(filter(gt_two, arr)) # returns [3] |
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
# This trick is introduced in the book called Python Tricks | |
# When you do this | |
with open('hello.txt', 'w') as f: | |
f.write('hello, world!') | |
# You're essentially doing this | |
f = open('hello.txt', 'w') | |
try: | |
f.write('hello, world') | |
finally: |
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
# Python accepts a comma at the end of your list/dict | |
# This is helpful when you define a list/dict vertically, helps you not forget to add a comma when adding a value | |
arr =[1, | |
2, | |
3,] | |
d = {1: 'a', | |
2: 'b', | |
3: 'c',} |