Skip to content

Instantly share code, notes, and snippets.

View reteps's full-sized avatar
💭
Student

Pete Stenger reteps

💭
Student
View GitHub Profile
@thecodeboss
thecodeboss / prisma-slonik-usage.ts
Created July 22, 2022 22:01
Prisma/Slonik Usage Example
import { PrismaClient } from '@prisma/client';
import type { User } from '@prisma/client';
import { createPool, sql } from 'slonik';
export const buildBaseConnectionURL = (config) => {
return (
'postgresql://' +
config.DB_USER +
':' +
config.DB_PASS +
@tonyg
tonyg / qnd_cbd.py
Created September 9, 2020 21:06
Quick-and-dirty plain-kernel-interface python modem boot and operation scripts for Samsung Galaxy S7
#!/usr/bin/env python3
# Per cbd, "SS310 modem", "shannon310". This is a Samsung Galaxy S7 SM-G930F.
# ["/sbin/cbd", "-d", "-tss310", "-bm", "-mm", "-P", "platform/155a0000.ufs/by-name/RADIO"]
boot0_path = '/dev/umts_boot0'
firmware_partition = '/dev/disk/by-partlabel/RADIO' ## maps to /dev/sda8 on my phone
nv_data_path = '/efs/nv_data.bin' ## mount /dev/disk/by-partlabel/EFS (/dev/sda3 for me) on /efs
import cffi
@busypeoples
busypeoples / InferProps.tsx
Created March 9, 2019 22:50
Infer Props using PropTypes.InferProps
import React from "react";
import { render } from "react-dom";
import PropTypes from "prop-types";
// Using PropTypes.InferProps
type InferPropTypes<
PropTypes,
DefaultProps = {},
Props = PropTypes.InferProps<PropTypes>
@fopina
fopina / mic_client.py
Created July 28, 2016 12:24
microphone streaming with pyAudio
#!/usr/bin/env python
import pyaudio
import socket
import sys
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
CHUNK = 4096
@baderj
baderj / tutorial_themoviedb.py
Last active October 18, 2022 17:02
Example how to use the API v3 of "The Movie Database" (themoviedb.org). Saves all available posters for the movie with IMDb id tt0095016 to the current folder, using the maximum available resolution.
import os
import requests
CONFIG_PATTERN = 'http://api.themoviedb.org/3/configuration?api_key={key}'
IMG_PATTERN = 'http://api.themoviedb.org/3/movie/{imdbid}/images?api_key={key}'
KEY = '<your_api_key>'
def _get_json(url):
r = requests.get(url)
return r.json()
@dugger
dugger / gist:1015379
Created June 8, 2011 20:56
How to create a User record via the Haiku LMS API, using C#.
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Web;
using System.IO;
using System.Collections.Specialized;
// Program start class
@metavida
metavida / gist:925985
Created April 18, 2011 19:23
How to list a User's Roster records via the Haiku LMS API, using Ruby.
require 'rubygems'
require 'oauth'
require 'xmlsimple'
# Create an OAuth Consumer with the appropriate API key and secret.
@consumer = OAuth::Consumer.new("api_key_EUNzNgVkrpFUFg", "api_secret_KBq6hTvjjvqAWOPz6c4WnQHN6jvkU8", { :site=>"https://my-domain.haikulearning.com" })
# Create an OAuth Access Token using your personal key and secret.
@access_token = OAuth::AccessToken.new(@consumer, "token_959b3659b65ddbb6f8552c3401", "secret_40ec1d3617e7f58811c2f1e4416dcf2f7")
@metavida
metavida / gist:88282
Created March 31, 2009 17:22
How to update a User record via the Haiku LMS API, using Ruby.
require 'rubygems'
require 'oauth'
require 'xmlsimple'
# Create an OAuth Consumer with the appropriate API key and secret.
@consumer = OAuth::Consumer.new("api_key_EUNzNgVkrpFUFg", "api_secret_KBq6hTvjjvqAWOPz6c4WnQHN6jvkU8", { :site=>"https://my-domain.haikulearning.com" })
# Create an OAuth Access Token using your personal key and secret.
@access_token = OAuth::AccessToken.new(@consumer, "token_959b3659b65ddbb6f8552c3401", "secret_40ec1d3617e7f58811c2f1e4416dcf2f7")