Skip to content

Instantly share code, notes, and snippets.

View creimers's full-sized avatar
🏠
Working from a great place

C Reimers creimers

🏠
Working from a great place
View GitHub Profile
import math
def calculate_transition_length(
radius: float,
ramp_height: float,
table_length: float) -> float:
height_ratio = ramp_height / radius
alpha = math.asin(1 - height_ratio)
length = math.cos(alpha) * radius
@creimers
creimers / vcards_remove_pictures.py
Created May 3, 2021 07:06
Python script to remove images from vcards (vcf) files.
import argparse
def main(file_path):
with open(file_path, "r") as the_file:
content = the_file.read()
new_lines = []
for line in content.split("\n"):
if (";" not in line and ":" not in line) or "PHOTO" in line:
pass
else:
convert *.HEIC -set filename:base "%[basename]" "%[filename:base].jpg"
jpegoptim *.jpg
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install autoconf libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev -y
sudo apt-get install avahi-daemon libavahi-client-dev -y
sudo apt-get install libssl-dev -y
cd ~
git clone https://github.com/mikebrady/shairport-sync.git
@creimers
creimers / example.jsx
Created April 24, 2020 14:43
react render props children
const Ding = (props) => {
const {children} = props
return children(
{text: "dong"}
)
}
const Dong = () => (
<Ding>
{({text}) => (
convert *.JPG -resize "600^>" -gravity center -crop 600x600+0+0 -strip -set filename:area "%t" '%[filename:area]-thumb.JPG'
@creimers
creimers / apollo-angular1-query.js
Created March 7, 2017 14:35
a basic example of how to use an apollo query with variables and angular 1
queryJobs() {
const jobQuery = gql`
query($city: String) {
jobs(city: $city){
id
title
teaser
imageSmall
published
}

Keybase proof

I hereby claim:

  • I am creimers on github.
  • I am creimers (https://keybase.io/creimers) on keybase.
  • I have a public key ASCSLxFxDoHughnws28kEUBu6qzUYHz6in3xXeQKJsvRmgo

To claim this, I am signing this object:

@creimers
creimers / lazy.js
Created December 9, 2016 13:11
Lazy loading with angular1 component router and webpack code split
class lazyAppCtrl {
constructor($q, $rootRouter, $ocLazyLoad) {
this.$q = $q
this.$rootRouter = $rootRouter
this.$ocLazyLoad = $ocLazyLoad
this.$rootRouter.config([
{
path: '/lazy',
name: 'Lazy',
RelatedObjectDoesNotExist: Page has no publisher_draft.
from cms.models import Page
pages = Page.objects.all()
ids = [page.id for page in pages if page.get_absolute_url()=='/mitmachen/das-kannst-du-tun/']
one = ids[0]
two = ids[1]
one.publisher_public = two