Skip to content

Instantly share code, notes, and snippets.

Avatar

Viktor Eriksson vikeri

  • Stockholm, Sweden
View GitHub Profile
@vikeri
vikeri / clean_mean.c
Created Mar 30, 2017
Cleaned mean in C
View clean_mean.c
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#define nsamples 254
float calculate_mean(uint16_t data[]) {
float sum = 0.0, mean;
uint16_t good_samples = 0;
uint16_t i;
@vikeri
vikeri / spotify.scpt
Created Oct 12, 2016
Spotify play script
View spotify.scpt
if application "Spotify" is running then
tell application "Spotify"
playpause
end tell
else
tell application "Spotify" to activate
tell application "Spotify"
playpause
end tell
end if
View spotify.applescript
if application "Spotify" is running then
tell application "Spotify"
playpause
end tell
else
tell application "Spotify" to activate
tell application "Spotify"
playpause
end tell
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@vikeri
vikeri / pre-commit
Created Aug 2, 2019
Prevent commit on master branch
View pre-commit
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to ".git/hooks/pre-commit".
if [ $(git rev-parse --abbrev-ref HEAD) == "master" ] ; then
@vikeri
vikeri / pre-push
Last active Aug 29, 2019
Prevent from pushing to master
View pre-push
#!/bin/bash
# Copy to .git/hooks/pre-push
# Run chmod +x .git/hooks/pre-push
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
View fix-metro-060-cljs.patch
--- worker.js 2019-12-05 18:53:48.000000000 -0800
+++ worker.js.orig 2019-12-05 18:53:30.000000000 -0800
@@ -268,10 +268,6 @@
plugins.push([inlineRequiresPlugin, opts]);
}
- if (!options.dev) {
- plugins.push([constantFoldingPlugin, opts]);
- }
-
@vikeri
vikeri / react.js
Created Dec 20, 2019
Shim React for RN, put this file in src
View react.js
goog.provides("react");
react = require("react");
@vikeri
vikeri / symbolicapache
Created Jan 23, 2015
create symbolic link serving as url (apache in linux)
View symbolicapache
# Useful way to manage urls in Apache, this creates a symbolic link in the /var/www folder
sudo ln -s /dir/with/files /var/www/yoururl