Skip to content

Instantly share code, notes, and snippets.

View vikeri's full-sized avatar

Viktor Eriksson vikeri

  • Stockholm, Sweden
View GitHub Profile
@vikeri
vikeri / react.js
Created December 20, 2019 20:08
Shim React for RN, put this file in src
goog.provides("react");
react = require("react");
--- 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 / pre-push
Last active August 29, 2019 07:38
Prevent from pushing to master
#!/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
@vikeri
vikeri / pre-commit
Created August 2, 2019 08:16
Prevent commit on master branch
#!/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

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:

if application "Spotify" is running then
tell application "Spotify"
playpause
end tell
else
tell application "Spotify" to activate
tell application "Spotify"
playpause
end tell
@vikeri
vikeri / clean_mean.c
Created March 30, 2017 12:47
Cleaned mean in 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 / str-replace.clj
Created December 29, 2016 07:59
String replace in boot
(deftask string-replace
"Replace strings in sources."
[p path PATH regex "Path to replace in."
s subs SUBS {str str} "Strings to replace"
r role ROLE kw "Input role of file after substitution, :resource or :source (default: :source)"]
(let [tmp (c/tmp-dir!)
fltr #(c/by-re [path] (c/input-files %))
; prev (atom nil)
]
(c/with-pre-wrap
@vikeri
vikeri / spotify.scpt
Created October 12, 2016 11:55
Spotify play script
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
@vikeri
vikeri / reload-android.scpt
Created October 12, 2016 07:52
Reload Android emulator Apple Script
do shell script "PATH=/usr/local/opt/android-sdk/platform-tools/ /Users/viktor/www/projects/pilloxa/script/reload-android"