Skip to content

Instantly share code, notes, and snippets.

View 0ex-d's full-sized avatar

Precious 0ex-d

View GitHub Profile
@polya20
polya20 / hedge-fund-agent-team-v1-4.ipynb
Created November 21, 2024 19:06 — forked from virattt/hedge-fund-agent-team-v1-4.ipynb
hedge-fund-agent-team-v1-4.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@toshvelaga
toshvelaga / youtubeViewCount.js
Created March 9, 2022 21:36
get youtube view count using Node JS
const express = require('express'),
router = express.Router(),
{ default: axios } = require('axios')
require('dotenv').config()
router.post('/api/youtube/view-count', async (req, res) => {
// https://developers.google.com/youtube/v3/docs/videos/list?apix=true&apix_params=%7B%22part%22%3A%5B%22statistics%2C%20status%22%5D%2C%22id%22%3A%5B%22_IrFoihwTUc%22%5D%7D#parameters
const youtubeBroadcastId = req.body.youtubeBroadcastId
@toshvelaga
toshvelaga / twitchViewCount.js
Created March 3, 2022 09:54
server side node function to get view count from twitch
const express = require('express'),
router = express.Router(),
{ default: axios } = require('axios')
require('dotenv').config()
router.post('/api/twitch/view-count', async (req, res) => {
// twitch forum: https://discuss.dev.twitch.tv/t/viewer-counter-help/24726/2
// https://discuss.dev.twitch.tv/t/getting-stream-viewer-count-webhook-notifications/20645/5
@jneem
jneem / main.rs
Created February 24, 2022 22:23
#![feature(bench_black_box)]
use rand::rngs::SmallRng;
use rand::{Rng, SeedableRng};
use std::hint::black_box;
use std::time::{Duration, Instant};
fn main() {
for error_rate in [0, 1, 10, 100] {
println!(
"sqrt {}: {:?}",
@OlgaRemit
OlgaRemit / [email protected]
Created February 24, 2022 22:22
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
const testQuery = async query => {
const pool = new sql.ConnectionPool({ // ... //})
try {
await pool.connect()
return await pool.request().query(`
BEGIN TRANSACTION
${query}
ROLLBACK TRANSACTION
`)
@abhinaykumar
abhinaykumar / Deploy monorepo to Heroku
Created November 10, 2020 13:59
Deploy monorepo to Heroku
1. Create Procfile at the root of each frontend and backend folder (with command to start the server)
2. Create Heroku dynos for each (frontend and backend)
```
heroku create -a my-awesome-frontend
heroku create -a my-awesome-backend
```
3. Get the auth token from Heroku by running: `heroku auth:token` #=> HEROKU_API_TOKEN
4. Add remote origin for frontend and backend
```
@dancywritter
dancywritter / youtube_id_regex.php
Created August 8, 2020 11:18 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@mihaitodor
mihaitodor / singularity_menu_extra_script.js
Created August 7, 2020 22:17
Hubspot/Singularity `extraScript` config hack for adding links in the menu to instances of a given service
<script>
fetch('/singularity/api/tasks/ids/request/{{ Environment }}_{{ Service }}')
.then(response => response.json()).then((taskIDs) => {
Object.values(taskIDs.healthy).forEach(function(task) {
fetch('/singularity/api/tasks/task/' + task.id)
.then(response => response.json()).then((taskInfo) => {
let host = taskInfo.taskId.host.replace(/_/g, '-');
let port = taskInfo.mesosTask.container.docker.portMappings[0].hostPort;
let a = document.createElement('a');
a.textContent = '{{ Service }} at ' + host + ':' + port;
import tweepy
# Authenticate to Twitter
auth = tweepy.OAuthHandler("CONSUMER_KEY", "CONSUMER_SECRET")
auth.set_access_token("ACCESS_TOKEN", "ACCESS_TOKEN_SECRET")
# Create API object
api = tweepy.API(auth)
# Create a tweet