Skip to content

Instantly share code, notes, and snippets.

View cpebble's full-sized avatar
👨‍🎓
Back at uni again(again)

Christian Påbøl Jacobsen cpebble

👨‍🎓
Back at uni again(again)
View GitHub Profile
@cpebble
cpebble / switch.py
Last active June 27, 2018 15:37
Python Switch
switch = lambda funcs, query: funcs[query] if query in funcs else funcs['default']
# Porting the switch statement to python
# GPL Christian Påbøl Jacobsen @mrcpj1998
import praw, subprocess
SUBREDDIT = "wallpapers"
r = praw.Reddit(client_id="",
client_secret="",
user_agent="WallpaperGrabber by /u/ParanoidBox")
allowedFormats = ['jpg', 'png']
urls = [post.url for post in r.subreddit(SUBREDDIT).hot() if post.url.split(".")[-1] in allowedFormats]
subprocess.call(['feh', "--bg-fill", urls[0])
#!/bin/bash
#$1 is low percent
#$2 is min percent
# Original script: github.com/mrcpj1998
# MIT License
# Batpercent script sourced from private github.com/chregon2001
lockFile="/tmp/batman.lck"
export BATMAN=true
hasWarned=1
if [ -f $lockFile ];
@cpebble
cpebble / RedditWallpaper
Created January 30, 2018 09:45
ReddidWallpaper
#!/usr/bin/python
import praw
import sys
import random
from pprint import pprint
import subprocess
SUBREDDIT = sys.argv[1] if len(sys.argv) > 1 else "offensive_wallpapers"
reddit = praw.Reddit(client_id='2RBn1ZOfEqZFkw',
client_secret='9sIGnCtbEd3Stio2v4_Nbljlh2g',