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
use crate::domain::interface::*; | |
use crate::domain::model::*; | |
use crate::error::*; | |
use crate::infra::DBConnector; | |
use crate::schema::tweet_records; | |
use async_trait::async_trait; | |
use diesel::dsl::*; | |
use diesel::prelude::*; | |
use serde::*; | |
use std::sync::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
// write Twitter API 2 get tweets about ekusiadadus using tokio with BEARER_TOKEN | |
use dotenv::dotenv; | |
#[tokio::main] | |
async fn main() -> Result<(), Box<dyn std::error::Error>> { | |
dotenv().ok(); | |
let bearer_token = std::env::var("BEARER_TOKEN").expect("BEARER_TOKEN not set"); | |
let client = reqwest::Client::new(); |
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 ( | |
"log" | |
"net/url" | |
"github.com/gorilla/websocket" | |
) | |
type JsonRPC2 struct { |
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" | |
"github.com/markcheno/go-quote" | |
"github.com/markcheno/go-talib" | |
"log" | |
"os" | |
) |
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 "sync" | |
func producer(ch chan int, i int) { | |
ch <- i * 2 | |
} | |
func consumer(ch chan int, wg *sync.WaitGroup) { | |
defer wg.Done() |
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 | |
func goroutine1(s []int, c chan int) { | |
sum := 0 | |
for _, v := range s { | |
sum += v | |
} | |
c <- sum | |
} |
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 | |
func goroutine1(s []int, c chan int) { | |
sum := 0 | |
for _, v := range s { | |
sum += v | |
} | |
c <- sum | |
} |
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 main() { | |
var a []int | |
a = make([]int, 5) | |
for i := 0; i < 5; i++ { | |
a = append(a, i) | |
fmt.Println(a) |
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 main() { | |
n := make([]int, 4, 5) | |
fmt.Printf("len=%d, cap=%d, slice=%v\n", len(n), cap(n), n) | |
n = append(n, 1) | |
fmt.Printf("len=%d, cap=%d, slice=%v\n", len(n), cap(n), n) | |
n = append(n, 2) |
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 requests | |
import os | |
import urllib | |
import json | |
import datetime | |
from google.cloud import bigquery | |
bearer_token = "[Your Token]" | |
headers = {"Authorization": "Bearer {}".format(bearer_token)} |
NewerOlder