Skip to content

Instantly share code, notes, and snippets.

View BetterProgramming's full-sized avatar

BetterProgramming

View GitHub Profile
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
//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", () =>{
#!/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##*/}"
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()
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");
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
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);
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 {
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 = [];
$ 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