Skip to content

Instantly share code, notes, and snippets.

View marcolussetti's full-sized avatar

Marco Lussetti marcolussetti

View GitHub Profile
graph_url = 'https://graph.facebook.com/v15.0/'
def post_image(caption='', image_url='',instagram_account_id='',access_token=''):
url = graph_url + instagram_account_id + '/media'
param = dict()
param['access_token'] = access_token
param['caption'] = caption
param['image_url'] = image_url
response = requests.post(url, params=param)
response = response.json()
return response
@mashingan
mashingan / sqlite3gorm.go
Last active August 20, 2023 16:04
Simple CRUD example working with Gorm
package main
import (
"fmt"
"net/http"
"strconv"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/sqlite"
"github.com/labstack/echo"
@mikepruett3
mikepruett3 / shell-setup.ps1
Last active July 28, 2024 17:25
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@ubergesundheit
ubergesundheit / readme.md
Last active June 24, 2024 06:57
systemd traefik.service

systemd Service Unit for Traefik

Adapted from caddy systemd Service Unit

The provided file should work with systemd version 219 or later. It might work with earlier versions. The easiest way to check your systemd version is to run systemctl --version.

Instructions

We will assume the following:

@myitcv
myitcv / 01_ReactTeamProposal.ts
Last active September 18, 2019 15:32
Typescript example comparing various signatures for getDerivedStateFromProps
interface MyCompProps {
model: Model;
modParams: ModParams;
}
interface MyCompState {
derived1?: Derived1;
derived2?: Derived2;
initialized: boolean;
@marcolussetti
marcolussetti / live_test.py
Last active October 14, 2019 01:30
Quick testing of recipe_scrapers with live data
#!/usr/bin/env python3
"""Quick and dirty check of what's running and what isn't"""
from recipe_scrapers import scrape_me
import pandas as pd
import numpy as np
import logging
log = logging.Logger("")
@Evantm
Evantm / BCFerriesCLI.py
Last active September 2, 2017 17:24
CLI interface for BC Ferries
import click
import requests
from urllib.parse import urlparse,parse_qs
routes = {'TSA':['30','01','09'],'HSB':['02','03','08'],'LNG':['03'],'SWB':['01','04','05'],'DUK':['30'],'NAN':['02']}
url = 'http://orca.bcferries.com:8080/cc/marqui/sailingDetail.asp?route={0}&dept={1}'
@click.command()
@click.option('-d','--depart', type=click.Choice(['TSA', 'HSB','LNG','SWB','DUK','NAN']), prompt='Departure',
help='Where the ferry is departing.')
@marcolussetti
marcolussetti / playerinfo.py
Last active July 12, 2017 18:43
NFL Player Info using nfldb
#!/usr/bin/env python2.7
# Queries nfldb for the team & position of a player
import nfldb
import sys
db = nfldb.connect()
q = nfldb.Query(db)
if len(sys.argv) < 2:
argument = raw_input("Enter player name: ")
else:
@alee
alee / views.py
Last active July 29, 2024 11:40
example Django view function that can be used for Discourse SSO, i.e., Discourse delegates User authentication to Django
import base64
import hmac
import hashlib
from urllib import parse
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseBadRequest, HttpResponseRedirect
from django.conf import settings
@login_required
@ibrahimlawal
ibrahimlawal / LC_CTYPE.txt
Created February 27, 2017 07:02 — forked from jampajeen/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8