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
services: | |
db: | |
image: mongo:latest | |
ports: | |
- "27017:27017" | |
container_name: db | |
volumes: shared_database:/data/db | |
vc_db: | |
image: mongo:latest | |
volumes: shared_database:/data/db |
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
//In bot.js | |
const token = <"YOUR_SAVED_BOT_TOKEN">; //Token that you saved in step 5 of this tutorial | |
const {Client, Intents} = require("discord.js"); | |
const client = new Client({ | |
intents:[ | |
Intents.FLAGS.GUILDS, | |
Intents.FLAGS.GUILD_MESSAGES | |
] | |
}); | |
client.on("ready", () =>{ |
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 bash | |
#: Your comments here. | |
set -o errexit | |
set -o nounset | |
set -o pipefail | |
work_dir=$(dirname "$(readlink --canonicalize-existing "${0}" 2> /dev/null)") | |
readonly conf_file="${work_dir}/script.conf" | |
readonly error_reading_conf_file=80 | |
readonly error_parsing_options=81 | |
readonly script_name="${0##*/}" |
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
sal = df.loc[:,["salary", "gender"]].groupby(["salary", "gender"]).size().reset_index() | |
sal.columns = ["Salary", "Gender", "Count"] | |
fig = px.bar(sal, x='Salary', y='Count', color="Gender", | |
barmode='group', title ="Salary Gender Distribution", | |
height=400, width=2000) | |
fig.update_traces(marker_line_color='rgb(9,50,100)', | |
marker_line_width=1.5, opacity=0.6) | |
fig.show() |
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 wsc; | |
// Depending on wsdl chosen, change this to enterprise or partner | |
import com.sforce.soap.enterprise.*; | |
import com.sforce.soap.enterprise.sobject.*; | |
import com.sforce.ws.*; | |
public class Main { | |
public static void main(String[] args) { | |
ConnectorConfig credentials = new ConnectorConfig(); | |
credentials.setPassword("YourPassword!apPenDdedSecurityToken); | |
credentials.setUsername("yoursalesforceusername@yourdomain.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
def train_epocs(model, epochs=10, lr=0.01, wd=0.0): | |
optimizer = torch.optim.Adam(model.parameters(), lr=lr, weight_decay=wd) | |
model.train() | |
for i in range(epochs): | |
usernames = torch.LongTensor(train_df.UserId.values) | |
game_titles = torch.LongTensor(train_df.TitleId.values) | |
ratings = torch.FloatTensor(train_df.Userscore.values) | |
y_hat = model(usernames, game_titles) | |
loss = F.mse_loss(y_hat, ratings) | |
optimizer.zero_grad() # reset gradient |
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 React, {Component} from 'react'; | |
import{AlertIOS,AppRegistry,Platform,StyleSheet,Text,TouchableOpacity,Button,View,} from 'react-native'; | |
import Video from 'react-native-video'; | |
export default class VideoPlayer extends Component { | |
static navigationOptions = ({ navigation }) =>({header:null}),}); | |
constructor(props) { | |
super(props); | |
this.onLoad = this.onLoad.bind(this); | |
this.onProgress = this.onProgress.bind(this); | |
this.onBuffer = this.onBuffer.bind(this); |
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
extension NSNotification.Name { | |
public static let deviceDidShakeNotification = NSNotification.Name("MyDeviceDidShakeNotification") | |
} | |
extension UIWindow { | |
open override func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) { | |
super.motionEnded(motion, with: event) | |
NotificationCenter.default.post(name: .deviceDidShakeNotification, object: event) | |
} | |
} | |
extension View { |
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 { lineString, along, lineDistance } from '@turf/turf'; | |
const OPTIONS = { units: 'feet' }; | |
// 30.1 seconds, the .1 is to allow a buffer for the next set of cords to load | |
// I know it's not exact, but it's close :) | |
const STEPS = 30100; | |
//inside component function | |
useEffect(() => { | |
let arc = []; |
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
$ vim web-ns.yaml | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: web | |
labels: | |
tier: web | |
$ kubectl apply -f web-ns.yaml | |
namespace/web created | |
$ vim middleware-ns.yaml |
NewerOlder