Skip to content

Instantly share code, notes, and snippets.

View zereraz's full-sized avatar
🐶
livin

Sahebjot singh zereraz

🐶
livin
View GitHub Profile
@zereraz
zereraz / todolist_complete.sh
Last active December 22, 2018 13:56
todolist (todolist.site) autocomplete
#!/bin/bash
_projects() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(todolist list by p | cut -d ' ' -f 2 | grep -E "^[^\\[]+$" | sed -e 's/^/+/g')
if [[ ${cur} == +* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
@zereraz
zereraz / functor
Last active August 11, 2018 13:34
module Main where
import Prelude
import Effect (Effect)
import Effect.Console (log)
data Maybe a = Nothing | Just a
a :: Maybe Int
@zereraz
zereraz / c_create.sh
Last active October 26, 2016 09:24
a script to create c files and open it in vim, "alias c_create=. c_create" is put in .zshrc or .bashrc file
#!/bin/bash
# first argument is the name of the folder and the c file
fileName=$1
# change to the desired folder
filePath='/Users/apple/Documents/coding/c/c_generated/'
folderToCreate="$filePath$fileName"
fileToCreate="$filePath$fileName/$fileName.c"
helloWorld="#include<stdio.h>\n\nint main(){\n\tprintf(\"Hello world\");\n}\n"
if [ ! -d "$folderToCreate" ]; then
@zereraz
zereraz / Bluetooth_edison.md
Last active August 29, 2015 14:25
Bluetooth edison

Commands

  • rfkill unblock bluetooth (first time)
  • hciconfig (status of bluetooth)
  • hciconfig name up (start bluetooth)
  • hciconfig name down (start bluetooth)
@zereraz
zereraz / gist:0e7ff9c46c3b8c89eef5
Created July 20, 2015 16:33
node null check example
var http = require('http');
var nullList = [];
function process(key,value) {
if(value === null || value === undefined){
nullList.push({
'key':key,
'value': value
})