Skip to content

Instantly share code, notes, and snippets.

View khaosdoctor's full-sized avatar
:shipit:
Always trying, never giving up

Lucas Santos khaosdoctor

:shipit:
Always trying, never giving up
View GitHub Profile
@khalidx
khalidx / node-typescript-esm.md
Last active April 17, 2024 12:32
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@ErickWendel
ErickWendel / gde-post-contribution.js
Last active March 8, 2023 13:02
Example of how to automate contribution submissions on GDE API
const axios = require('axios')
class GDEAPI {
constructor({ token }) {
this.token = token
}
async submitContributions(body) {
const headers = {
"accept": "application/json, text/plain, */*",
"accept-language": "en-US,en;q=0.9",
@ErickWendel
ErickWendel / youtube-video-analytics.js
Created September 16, 2021 20:00
Example of how to get video views from youtube
const YOUTUBE_KEY = "YOUR YOUTUBE KEY"
import axios = from 'axios';
function getVideoId(link) {
const videoId = link.match(/v=(?<videoId>.*)/)?.groups?.videoId
return videoId
}
async function getVideoViews(link) {
const videoId = getVideoId(link)
@ErickWendel
ErickWendel / linkedin-post-analytics-example.mjs
Last active July 22, 2022 12:00
Example of how to get post Analytics such as Views from a Linkedin post
// paste this file on a empty directory
// npm i axios
// You should go to your browser on Cookie session and get JSESSIONID and li_at from Linkedin Section
const JSESSIONID = 'YOUR JSESSIONID'
const liAT = 'YOUR li_at'
import axios from 'axios'
const headers = {
@khaosdoctor
khaosdoctor / workingwithlucas-en-us.md
Last active October 1, 2023 21:46
Useful info when working with me

Working with Lucas

Creation Date: June 2020

Status: in progress

A collection of stuff that might come in handy when working with me

My personal philosophy:

@khaosdoctor
khaosdoctor / insta_save.js
Created December 15, 2018 16:03
Saves all your saved images on instagram
Array.from($('#react-root > section > main > div > header + div + div + div > article > div > div').children).forEach(row => {
Array.from(row.children).forEach(async (image) => {
try {
const photoUrl = image.querySelector('a').getAttribute('href')
const response = await fetch(`https://instagram.com${photoUrl}`)
const responseText = await response.text()
const parser = new DOMParser()
const htmlDocument = parser.parseFromString(responseText, 'text/html')
const sharedData = JSON.parse(htmlDocument.querySelector('#react-root+script').innerText.replace('window._sharedData = ', '').replace('};', '}'))
const picData = sharedData.entry_data.PostPage[0] ? sharedData.entry_data.PostPage[0].graphql.shortcode_media : sharedData.entry_data
@wh1tney
wh1tney / deploy-static-site-heroku.md
Last active July 2, 2023 17:33
How to deploy a static website to Heroku

Gist

This is a quick tutorial explaining how to get a static website hosted on Heroku.

Why do this?

Heroku hosts apps on the internet, not static websites. To get it to run your static portfolio, personal blog, etc., you need to trick Heroku into thinking your website is a PHP app. This 6-step tutorial will teach you how.

Basic Assumptions

@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@willurd
willurd / web-servers.md
Last active April 18, 2024 14:15
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000