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
https = require 'https' | |
https.get { host: 'api.ipify.org', path: '/?format=json' }, (res) -> | |
console.log 'statusCode:', res.statusCode | |
console.log 'content-type:', res.headers['content-type'] | |
data = '' | |
res.on 'data', (chunk) -> | |
data += chunk.toString() | |
res.on 'end', () -> | |
console.log 'publicIP:', JSON.parse(data)['ip'] |
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
#!/usr/bin/env python3 | |
from configparser import ConfigParser | |
from slackclient import SlackClient | |
config = ConfigParser() | |
config.read('slack.conf') | |
SLACK_TOKEN = config['slack']['SLACK_API_TOKEN'] | |
sc = SlackClient(SLACK_TOKEN) | |
if sc.rtm_connect(): |
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
#!/usr/bin/env python3 | |
from slackclient import SlackClient | |
from configparser import ConfigParser | |
from weatherman import WeatherAPI | |
config = ConfigParser() | |
config.read('api_secrets.conf') | |
SLACK_TOKEN = config['slack']['SLACK_API_TOKEN'] | |
weather = WeatherAPI.get_current_conditions(90210) |
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
#!/usr/bin/env python3 | |
import requests | |
import sys | |
from configparser import ConfigParser | |
class WeatherAPI: | |
def get_current_conditions(zip_code): | |
# Try and read in api key from default config | |
try: |
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
#!/usr/bin/env python3 | |
# my reference list | |
nums = [1,2,3,4,5,6,7,8,9,10] | |
# 'n' for each 'n' in nums list | |
my_list = [] | |
for n in nums: | |
my_list.append(n) | |
print(my_list) |
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
#!/usr/bin/env python3 | |
class Employee: | |
def __init__(self, first_name, last_name, salary, position): | |
self.first_name = first_name | |
self.last_name = last_name | |
self.salary = salary | |
self.position = position | |
self.email = first_name + '.' + last_name + '@div.company.com' |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"io/ioutil" | |
"encoding/json" | |
) |
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
package main | |
import "fmt" | |
func add(x int, y int, greet string) (integer int, res string) { | |
sum := x + y | |
response := greet + ", World" | |
return sum, response | |
} |
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
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
"io/ioutil" | |
"encoding/json" | |
) |
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
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
"os" | |
) |