Skip to content

Instantly share code, notes, and snippets.

Avatar

Axel axelerator

  • Shopify
  • Montreal, Canada
View GitHub Profile
@axelerator
axelerator / vrg.sh
Created May 26, 2020
Open all files found with ripgrep in vim
View vrg.sh
#!/bin/sh
MATCHES=`rg -l $@ `
echo "$MATCHES"
read -p "Open these files?([Y/n])" -n 1 -r
if [[ $REPLY = '' || $REPLY =~ ^[Yy]$ ]]
then
FILES=`echo $MATCHES | tr "\n" ' '`
vim $FILES
@axelerator
axelerator / Animation and Naviagation
Last active May 3, 2020
animation_navigation.elm
View Animation and Naviagation
module Main exposing (Model, Msg(..), init, main, subscriptions, update, view)
import Animation exposing (px)
import Browser
import Browser.Navigation as Nav
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Url
View input.hs
main = do
hSetBuffering stdin NoBuffering
hSetEcho stdin False
mVar <- newMVar ""
putStrLn "Go"
runAfterDelay 1000000 (appender mVar "foo")
runAfterDelay 2000000 (appender mVar "bar")
typer mVar
putStrLn "Main done"
@axelerator
axelerator / handleplay.ino
Created Oct 18, 2018
Customize play function to support different frequencies
View handleplay.ino
void handlePlay() {
String response = "POSTED";
response += server.arg("timings");
readCSV(server.arg("timings"));
for (int i = 0; i < current_data_length; ++i) {
Serial.println(signal_data[i]);
}
int frequency = server.arg("frequency").toInt();
irsend.sendRaw(signal_data, current_data_length, frequency); // Send a raw data capture at frequency given as request parameter.
server.sendHeader("Access-Control-Allow-Origin", "*");
@axelerator
axelerator / yaml key sorting in vim
Last active Sep 21, 2017
yaml key sorting in vim
View yaml key sorting in vim
nmap <leader>y :!yml-sorter -i % -o %<CR>
https://www.npmjs.com/package/yml-sorter
View gist:01ab50c21a25a1b93164f86a087dfda0
upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/var/www/APP_NAME/shared/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name APP_NAME.42ls.de APP_NAME.42ls.de;
View custom_search.rb
class HomeController < ApplicationController
class MovieSearch < FortyFacets::FacetSearch
model 'Movie' # which model to search for
custom :for_manual_handling
end
def index
@axelerator
axelerator / onliners
Last active Apr 22, 2016
oneliners.md
View onliners
# Ruby
Hash[*((0..4).flat_map{|i| ['column_' + i.to_s, nil]})]
# => {"column_0"=>nil, "column_1"=>nil, "column_2"=>nil, "column_3"=>nil, "column_4"=>nil}
# Shell
### Bildersequenzen in Video für Web konvertieren mit:
@axelerator
axelerator / sumgitachievements.sh
Created Sep 27, 2011
sum of all git achievement levels
View sumgitachievements.sh
git achievements -l | grep '(Level' | sed 's/\(\s*.*(Level\)//g' | tr -d ')' | tr -s ' ' |tr "\n" '+' | sed 's/$/ 0/' | xargs expr
@axelerator
axelerator / namevoting
Created Jun 19, 2011
Small programm to combine syllables, where some syllables are used only as suffix/prefix
View namevoting
{-
- Small programm to combine syllables, where some syllables
- are used only as suffix/prefix
- 1. Install: GHC
- 2. Compile: ghc -o namevote namevoting.hs
- 3. Run: namevote '[Pre "neo", Suf "master", Pre "turbo", Uni "leo", Suf "3000"]'
-}
module Main where
import System.Environment
You can’t perform that action at this time.