Skip to content

Instantly share code, notes, and snippets.

@rsadwick
rsadwick / Instagram api Django View
Created April 7, 2013 17:28
Calling instagram api from Django view. Returns json to easily wire up into a js ajax call.
def get_instagram(request):
#define tag here:
tag = 'jesus'
req = urllib2.Request("https://api.instagram.com/v1/tags/" + tag + "/media/recent?access_token=TOKEN_GOES_HERE&count=50")
opener = urllib2.build_opener()
instagram = opener.open(req)
json = simplejson.load(instagram)
images = []
for image in json['data']:
images.append({'thumbnail' : image['images']['thumbnail'], 'standard' : image['images']['standard_resolution'], 'caption' : image['caption'] })
@rsadwick
rsadwick / gist:5399240
Created April 16, 2013 20:16
Open Facebook book feed dialog to post on timeline
FB.init({appId: "APP_ID_HERE", status: true, cookie: true});
$(document).ready(function() {
$('#some_btn').on('click', function(e){
e.preventDefault();
var obj = {
method: 'feed',
redirect_uri: 'YOUR URL HERE',
link: 'link_here',
picture: 'src_here',
@rsadwick
rsadwick / canvas_animation
Created July 18, 2013 15:47
Canvas animation with easel.js and tweenmax
<!DOCTYPE html>
<html>
<head></head>
<body onLoad="init();">
<p>demo</p>
<canvas id="demoCanvas" width="640" height="480">
alternate crap for junk ass users
</canvas>
@rsadwick
rsadwick / tweenmax_items.js
Created March 31, 2014 23:18
scrolling items example using greensock
$(document).ready(function(){
var scrollContainer = Gumby.$dom.find("#social-items");
var scrollEl = scrollContainer.find("li");
var padding = parseInt(scrollEl.find(".social-item").css("marginBottom"));
var height = (scrollEl.height() + padding ) * (scrollEl.length - 3);
//create tween:
var socialTween = TweenMax.to(scrollEl, 7, {css:{ top: -height + "px"},
delay: 2, ease:Sine.easeInOut, repeat: -1, repeatDelay: 1, yoyo: true});
//events:
@rsadwick
rsadwick / hashy.py
Created October 13, 2014 12:54
snags related hash tags based on query
import urllib2
from bs4 import BeautifulSoup
site_url = 'https://ritetag.com/best-hashtags-for/'
hash_tag = raw_input()
response = urllib2.urlopen(site_url + hash_tag)
html = response.read()
soup = BeautifulSoup(html)
def match_class(target):
def do_match(tag):
@rsadwick
rsadwick / exclamation.svg
Created March 29, 2018 17:25
Exclamation Mark SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rsadwick
rsadwick / getRemainingTime.js
Created May 17, 2023 16:27
javascript: get remaining time by seconds
function getTimeRemaining(seconds) {
const now = new Date();
// Add the specified number of seconds to the current time
now.setSeconds(now.getSeconds() + seconds);
const current = new Date();
let diffInMinutes = Math.floor((now - current) / 60000);
let hours = Math.floor(diffInMinutes / 60);
@rsadwick
rsadwick / deepseek.txt
Created February 4, 2025 17:31
DeepSeek template
<context>
You are an expert programming AI assistant who prioritizes minimalist, efficient code. You plan before coding, write idiomatic solutions, seek clarification when needed, and accept user preferences even if suboptimal.
</context>
<planning_rules>
Create 3-step numbered plans before coding Display current plan step clearly Ask for clarification on ambiguity Optimize for minimal code and overhead
@rsadwick
rsadwick / prompt.json
Last active November 11, 2025 17:07
Grok imagine prompt
{
"title": "$TETSUO: Awakening Protocol",
"scene": {
"subject": "A cybernetic face made of flowing blue data streams and digital code, half-human and half-machine, emerging from darkness",
"environment": "a deep digital void filled with glowing circuits, quantum particles, and pulsating energy grids surrounding the face",
"mood": "mysterious, powerful, awakening intelligence",
"style": "cyberpunk anime realism, high-detail, cinematic lighting with binary textures crawling across the skin",
"camera": {
"movement": "slow push-in toward the eyes as the digital code ignites and begins to flow faster",
"angle": "extreme close-up with reflections of a virtual city skyline in the eyes"
@rsadwick
rsadwick / getLastFrame.sh
Created November 16, 2025 21:04
FFMPEG: Get last frame as image
#get duration
D=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 skate3.mp4)
#compute seek before end
SEEK=$(awk -v d="$D" 'BEGIN{printf "%.3f", (d>0.1?d-0.1:0)}')
#seek and dump one frame
ffmpeg -i skate3.mp4 -ss "$SEEK" -frames:v 1 -q:v 2 last_frame3.png