Skip to content

Instantly share code, notes, and snippets.

Avatar
🐱
JITL

Niclas Kron sphrak

🐱
JITL
View GitHub Profile
View game.py
import random
from time import sleep
import pygame
class CarRacing:
def __init__(self):
pygame.init()
@sphrak
sphrak / import-images-windows.bat
Last active May 7, 2019
Microsoft removed the standard camera import feature in windows > 7 and forces you to use their dumb app. This is what it has come down to.
View import-images-windows.bat
@echo off
set TARGET=D:\DCIM\path
set DESTINATION=C:\path\to\photos\%date%
echo Copying images from camera %TARGET% to %DESTINATION%
echo d | xcopy /s /y %TARGET% %DESTINATION%\
echo Removing images from camera..
del /s /q "%TARGET%\*.JPG"
PAUSE
@sphrak
sphrak / bootable-windows-on-usb.md
Last active Apr 23, 2019
Copy windows iso contents to a usb memory and make it bootable
View bootable-windows-on-usb.md

0. Format partition to ntfs somehow

1. Mount usb drive

mount /dev/sdX /media/usb

2. Mount iso

mount windows.iso /media/windows
@sphrak
sphrak / gradient.js
Created Apr 5, 2019 — forked from siamak/gradient.js
Steps in Gradient
View gradient.js
/**
* GradientArray • Steps gradient.
* @author Siamak Mokhtari <hi@siamak.work>
* @date 06/21/16.
*/
class GradientArray {
// Convert a hex color to an RGB array e.g. [r,g,b]
// Accepts the following formats: FFF, FFFFFF, #FFF, #FFFFFF
hexToRgb(hex) {
let r, g, b, parts;
@sphrak
sphrak / unrar.sh
Created Feb 3, 2019
Extract all rar archives recursively and delete if extraction was successful
View unrar.sh
#!/bin/bash
for file in $(find . -iname '*.rar'); do
echo "Extracting ${file}..."
dir=$(dirname ${file})
unrar e -y -o+ -p- "${file}" "${dir}"
# check exit status, if not 0 it failed
@sphrak
sphrak / Jenkinsfile
Created Jul 17, 2018 — forked from jonico/Jenkinsfile
Example for a full blown Jenkins pipeline script with multiple stages, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, stage timeouts, stage concurrency constraints, ...
View Jenkinsfile
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
/*
Please make sure to add the following environment variables:
HEROKU_PREVIEW=<your heroku preview app>
HEROKU_PREPRODUCTION=<your heroku pre-production app>
HEROKU_PRODUCTION=<your heroku production app>