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
import torch.multiprocessing as mp
mp.set_sharing_strategy("file_system")
class InMemoryMap(Dataset):
def __init__(self,
ds,
gpu=False):
self.ds = ds
self.device = torch.device("cuda:0" if gpu else "cpu")
self.samples = None

Keybase proof

I hereby claim:

  • I am cpebble on github.
  • I am cpebble (https://keybase.io/cpebble) on keybase.
  • I have a public key ASCOI8lX3x0I7cAWNVTkIoVEpScBOoaw-NDEQxet2JNxMAo

To claim this, I am signing this object:

@cpebble
cpebble / fzbz.js
Last active September 17, 2020 13:31 — forked from chregon/fzbz.js
Fizzbuzz but can i do FP? no u
function iota (n) { // Pretty genius implementation
return [...Array(n).keys()]
}
function fizzbuzz (n) {
return iota(30).map( x =>
(x % 15 === 0 ? "fizzbuzz" : x % 3 == 0 ? "fizz" : x % 5 == 0 ? "buzz" : x.toString())
)
}
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'
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>
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:
@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>
//

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:

#!/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(