Skip to content

Instantly share code, notes, and snippets.

View Inkering's full-sized avatar
📰
✍️

Dieter Brehm Inkering

📰
✍️
View GitHub Profile
;;; Emacs Config
;; by Dieter Brehm
;; place custom lisp code here
(add-to-list 'load-path "~/.emacs.d/custom-lisp")
;; improve startup time
(setq-default file-name-handler-alist nil
gc-cons-threshold 402653184
gc-cons-percentage 0.6)
struct Speeds {
// struct
int left;
int right;
};
Speeds new_speed;
Speeds last_speed;
Speeds PID(int leftSensor, int rightSensor) {
@Inkering
Inkering / fileSaving.swift
Created July 26, 2019 18:43
Snippet for mixed type file saving
import UIKit
import Foundation
import PlaygroundSupport
var str = "Hello, playground"
var fileName = "thisisatest.txt"
let fileUrl = playgroundSharedDataDirectory.appendingPathComponent(fileName)
let listOfTasks = [["Hi", "Hello", "12:00"], ["Hey there", "What's up?", "3:17"], [1,2,3,4]]
;; append string from my-agend-indent-string to the agenda itself
(defun my-agenda-prefix ()
(format "%s" (my-agenda-indent-string (org-current-level))))
;; generate a string that contains correct hierarchy for a task
;; given it's level, i.e. "──►"
(defun my-agenda-indent-string (level)
(if (= level 1)
""
(let ((str ""))
#!/bin/bash
# This script allows for the quick creation of project directories for quick c++ practicing
#create directory structure
if [ ! -d practice-$1 ]; then
git init practice-$1
mkdir practice-$1/src practice-$1/build practice-$1/includes
cd practice-$1
else
aTrain = [1, 0, 1, 0, 0, 0]
# list as input
# return tuple or length 2 with two lists of resultant trains
def splitTrain(train):
inputTrain = train
inputLength = len(inputTrain)
inputMiddleIndex = inputLength // 2
var a = [34, 203, 3, 746, 200, 984, 198, 764, 9];
function bubbleSort(a)
{
var swapped;
do {
swapped = false;
for (var i=0; i < a.length-1; i++) {
if (a[i] > a[i+1]) {
var temp = a[i];
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 73 columns, instead of 61 in line 1.
"W","h","e","n"," ","P","i","c","k","i","n","g"," ","A","p","p","l","e","s"," ","o","n"," ","a"," ","F","a","r","m"," ","W","i","t","h"," ","5",",","0","0","0"," ","R","u","l","e","s",","," ","W","a","t","c","h"," ","O","u","t"," ","f","o","r"," ","t","h","e"," ","L","a","d","d","e","r","s"
"A"," ","C","a","m","p","a","i","g","n"," ","M","e","m","o","i","r"," ","T","h","a","t"," ","S","h","o","w","s"," ","T","r","u","m","p",","," ","a","t"," ","L","e","a","s","t"," ","P","a","r","t","l","y",","," ","a","s"," ","H","e"," ","I","s"
"O","n"," ","N","e","w"," ","I","n","d","i","a","n"," ","C","o","n","d","o","s",","," ","t","h","e"," ","N","a","m","e"," ","I","s"," ","T","r","u","m","p",","," ","a","n","d"," ","t","h","e"," ","L","u","r","e"," ","I","s"," ","M","e","e","t","i","n","g"," ","O","n","e"
"‘","T","r","u","m","p"," ","P","l","a","c","e","’"," ","A","s","k","s"," ","i","f"," ","I","t"," ","C","a","n"," ","B","e"," ","C","a","l","l","e","d"," ","b","y"," ","A","n","y"," ","O","t","h","e","r"," ","N","a",
import math
while(1):
robotLeft = 0
robotRight = 0
x = float(input("Input x \n"))
y = float(input("Input y \n"))
z = float(input("Input z \n"))
;;; Emacs Config
;;;; indentation
(setq c-default-style "linux"
c-basic-offset 4
sgml-basic-offset 4)
(c-set-offset `inline-open 0)
(setq-default tab-width 4)
;;;; misc
(setq-default show-trailing-whitespace t)