Skip to content

Instantly share code, notes, and snippets.


Simon stoivo

  • Oslo, Norway
View GitHub Profile
View my general bash stuff
function setCurrentTabName () {
WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool windowfocus $WID
xdotool key ctrl+i
xdotool key BackSpace
xdotool type $1
xdotool key Return
function maybeCreateNewTab() {
stoivo / Git superhelper
Created Sep 29, 2014
This is a tool to speed up git commands in terminal
View Git superhelper
function g {
# if you not in a repo STOP now
case $1 in
'' )
git status
'loop' )
git_status_res_without_delete=$(git status | grep -v 'On branch' | grep -v 'Your branch is' | grep -v 'use "git push" to publish' | grep -v 'Changes to be committed' | grep -v 'use "git reset HEAD' | grep -v 'Changes not staged for' | grep -v 'to update what will be committed' | grep -v 'discard changes in working directory' | grep -v 'include in what will be committed' | grep -v "grep -v 'include in what will be committed'"| grep -v "git branch --unset-upstream" | grep -v "added to commit but untracked files present" | grep -v "nothing to commit, working dir" | grep -v " deleted: " | grep -v "Your branch and" | grep -v "different commits each, respectively." | grep -v "to merge the remote branch into yours)" | grep -v "You have unmerged paths" | grep -v "(fix conflicts and run " | grep -v "Unmerged paths:" | grep -v "to mark resolution)" | grep -v "renamed: ")
public class Regneklynge {
int antNode;
ArrayList<Rack> racks = new ArrayList<Rack>();
public void setInnNode(Node node){
boolean sattInn = false
for (int i = 0; i < racks.length-1; i++) {
if (racks[i].setinNode(node)) {
sattInn = true;
stoivo / add_csrf_token_to_request.js
Created May 19, 2017
This is one way to add csrf-token to your request from elm to rails. This is general solution, I use it with rails.
View add_csrf_token_to_request.js
var send = XMLHttpRequest.prototype.send,
token = document.querySelector("meta[name=csrf-token]").getAttribute("content");
XMLHttpRequest.prototype.send = function(data){
this.setRequestHeader('X-CSRF-Token', token);
return send.apply(this, arguments);
View cap staging doctor
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
Ruby ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin17]
Rubygems 2.6.13
Bundler 1.16.0
Command /Users/user_name/.rbenv/versions/2.4.2/gemsets/product/bin/cap fb2016 doctor
View PrisonBreak.rb
# oneline
a=[self].unshift 'secret';a.unshift 33;a.unshift :unlock;s=%w[se nd].join'';m=self.prison.method s.to_sym;m.to_proc[*a]
# mulltiline
a=[self].unshift 'secret';
a.unshift 33;
a.unshift :unlock;
s=%w[se nd].join'';
m=self.prison.method s.to_sym;
View tubby_genral_compopent_reuse.rb
# /app/components/link_as_button.rb
class LinkAsButton
attr_reader :href
attr_reader :disabled
def initialize(
disabled: false
@href = href
You can’t perform that action at this time.