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 / 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',
#!/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 ];
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])
@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
#!/bin/bash
echo Fetching reddit links
postJSON=$(curl -s 'https://www.reddit.com/r/wallpapers.json?limit=100' -A "Wallpaper fetcher by /u/cpcp800")
# OMG fucking sed horrorbeast no judging
resolutions=$(resolutions | sed 's/.*\([0-9][0-9][0-9][0-9]x[0-9][0-9][0-9][0-9]\+\).*/\1/')
echo JSON Fetched
parseJSON () {
echo $postJSON | jq --arg HEIGHT "$1" --arg WIDTH "$2" '.data.children[]
| select(

Keybase proof

I hereby claim:

  • I am mrcpj1998 on github.
  • I am cpebble (https://keybase.io/cpebble) on keybase.
  • I have a public key ASBHZ66_6OCDvy-bUaVcnbsxve_YeDJFdvuUwhzChRY2dgo

To claim this, I am signing this object:

@cpebble
cpebble / tfgets.c
Last active October 28, 2019 20:53
KageNuPlx
#define _POSIX_C_SOURCE 1
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <assert.h>
//
from random import randint
# Lad os lige lave noget data
data = [randint(-100, 100) for _ in range(100)]
# map
data_mapped = map(lambda a: a**2, data)
# Og med builtins
data_mapped_2 = []
for a in data:
module Testing
/// <summary>En funktion der tager en tuple med tests.
/// Understøtter også to pointers med til succeser og fejltagelser </summary>
/// <remarks></remarks>
/// <param name='func'>En testfunction</param>
/// <param name='funcName'>Funktionsnavnet der bliver testet</param>
/// <param name='tests'>Tuple med tests</param>
/// <param name='succPointer'>Pointer der inkrementeres når en test består</param>
/// <param name='succPointer'>Pointer der inkrementeres når en test fejler</param>
/// <returns>Unit; Printer, men returner intet</returns>
call plug#begin('~/.local/share/nvim/plugged')
Plug 'vim-airline/vim-airline'
Plug 'sjl/badwolf'
Plug 'morhetz/gruvbox'
Plug 'iCyMind/NeoSolarized'
Plug 'scrooloose/syntastic'
Plug 'scrooloose/nerdtree'
Plug 'lervag/vimtex', { 'for': 'tex'}
Plug 'KeitaNakamura/tex-conceal.vim', {'for': 'tex'}
Plug 'Valloric/YouCompleteMe'