Skip to content

Instantly share code, notes, and snippets.

Avatar

Philipp Bosch philippbosch

View GitHub Profile
@philippbosch
philippbosch / sprintf.ino
Created Apr 16, 2013
sprintf() in Arduino code
View sprintf.ino
unsigned int i = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
char buffer[50];
sprintf(buffer, "the current value is %d", i++);
Serial.println(buffer);
View index.html
<div id="currentNumber"> </div>
<button id="increment">+</button>
<button id="reset">Reset</button>
<script src="https://cdn.firebase.com/v0/firebase.js"></script>
<script>
var currentNumber = document.getElementById('currentNumber');
var incrementButton = document.getElementById('increment');
var resetButton = document.getElementById('reset');
@philippbosch
philippbosch / index.html
Created Apr 12, 2013
WebSockets example
View index.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>WebSocket Test</title>
</head>
<body>
<script>
var ws = new WebSocket('ws://172.18.246.234:8080/p5websocket');
ws.onopen = function() {
@philippbosch
philippbosch / sine.js
Last active Dec 28, 2021
Sine in JS and in Processing
View sine.js
var sprintf = require('sprintf').sprintf; // only needed for formatting the console output
var counter = 0;
var increase = Math.PI * 2 / 50;
var i=0;
setInterval(function() {
var val = Math.sin(counter-Math.PI/2)/2+0.5;
counter += increase;
console.log(sprintf("%.3f %" + Math.round(val*60) + "s", val, "."));
@philippbosch
philippbosch / index.html
Last active Dec 16, 2015
Connection from a web app to a Processing sketch through websockets
View index.html
<script>
// Create a connection to the server
var ws = new WebSocket('ws://172.18.246.234:8080/p5websocket');
// As soon as the connection is established, send a "Ping" message to the server
ws.onopen = function() {
ws.send('Ping');
};
// Whenever we receive a message from the server, display it in a popup
@philippbosch
philippbosch / _animations.scss
Last active Aug 29, 2019
Compass mixins for CSS keyframe animations
View _animations.scss
@import "compass/css3/shared";
@mixin keyframes($name) {
@-webkit-keyframes $name {
@content;
}
@-moz-keyframes $name {
@content;
}
View slic3r-config.ini
# generated by Slic3r 0.9.8 on Mon Feb 25 19:40:40 2013
bed_size = 140,140
bed_temperature = 110
bottom_solid_layers = 3
bridge_fan_speed = 100
bridge_flow_ratio = 1
bridge_speed = 60
brim_width = 0
complete_objects = 0
cooling = 1
View README.html
<h2>Installation</h2>
<p>
Drag and drop the following link to your bookmarks bar:<br>
<a href="javascript:(function() { var elem=document.createElement('script'); elem.setAttribute('src', 'https://gist.github.com/philippbosch/5018940/raw/pinterest-slideshow.js?t='+(new Date().getTime())); document.body.appendChild(elem); }())">Slideshow</a>
</p>
View gist:3857869
from PIL import Image
im = Image.open(myfile)
info = im._getexif()
orientation = info.get(274,1)
if orientation == 3:
im.rotate(180)
elif orientation == 5 or orientation == 6:
@philippbosch
philippbosch / igs-bildungsbroschuere.html
Created Aug 31, 2012
igs Bildungsbroschüre Embed Code
View igs-bildungsbroschuere.html
<object style="width:630px;height:600px">
<param name="movie" value="http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf?mode=mini&amp;embedBackground=%23ffffff&amp;shareMenuEnabled=false&amp;printButtonEnabled=false&amp;shareButtonEnabled=false&amp;searchButtonEnabled=false&amp;backgroundColor=%23ffffff&amp;documentId=120831175130-0a8197e8ecc74535a2771076491338a9">
<param name="allowfullscreen" value="true">
<param name="menu" value="false">
<param name="wmode" value="transparent">
<embed src="http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf" type="application/x-shockwave-flash" allowfullscreen="true" menu="false" wmode="transparent" style="width:630px;height:600px" flashvars="mode=mini&amp;embedBackground=%23ffffff&amp;shareMenuEnabled=false&amp;printButtonEnabled=false&amp;shareButtonEnabled=false&amp;searchButtonEnabled=false&amp;backgroundColor=%23ffffff&amp;documentId=120831175130-0a8197e8ecc74535a2771076491338a9">
</object>