Skip to content

Instantly share code, notes, and snippets.

View deepakkarki's full-sized avatar
🎯
Focusing

Deepak Karki deepakkarki

🎯
Focusing
View GitHub Profile
@deepakkarki
deepakkarki / express-server-side-rendering.md
Created July 3, 2018 10:27 — forked from joepie91/express-server-side-rendering.md
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
@deepakkarki
deepakkarki / 0_reuse_code.js
Created December 11, 2016 05:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#include <Servo.h>
Servo myservo;
int key_inserted,gear_pedal;
boolean stand_up;
void setup() {
myservo.attach(9);
pinMode(8,INPUT);
@deepakkarki
deepakkarki / client.py
Last active August 29, 2015 14:07 — forked from micktwomey/client.py
import socket
if __name__ == "__main__":
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("localhost", 9000))
data = "some data"
sock.sendall(data)
result = sock.recv(1024)
print result
sock.close()
package com.example.nostalgia;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
package com.example.nostalgia;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStreamWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;

PRU Speak

##What is it

PRU Speak is an implementation of the BotSpeak language for the PRU. This project enables dynamic control of the Beaglebone black's PRU (Programmable Realtime Unit) from the Linux userspace on ARM.

BotSpeak is a robotics programming language designed to bridge the gap between small embedded systems such as the Raspberry Pi, BeagleBone, and Arduino. [See http://botspeak.org/ and https://sites.google.com/site/botspeak/ for more information]

root@beaglebone:~/pruspeak/src/dts# diff BB-PRUSPEAK-00A0.dts BB-BONE-PRU-07-00A0.dts
15c15
< part-number = "BB-PRUSPEAK";
---
> part-number = "BB-BONE-PRU-04";
@deepakkarki
deepakkarki / pruspeak-todo.txt
Created August 10, 2014 14:06
TODO list of PRU-Speak
A. For Beta release :
1. dist package
2. tcp test
3. examples
4. make files
5. upstream kernel code
6. re-vamp docs
7. error warnings and exception handling
B. Further work :
3554.801664] pru-rproc2 4a300000.prurproc: #8 PRU interrupts registered
[ 3554.801865] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [17] <- 1
[ 3554.801906] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [18] <- 0
[ 3554.801944] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [19] <- 2
[ 3554.801981] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [20] <- 3
[ 3554.802018] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [21] <- 0
[ 3554.802054] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [22] <- 1
[ 3554.802090] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [24] <- 4
[ 3554.802127] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [25] <- 5
[ 3554.802162] pru-rproc2 4a300000.prurproc: sysevent-to-channel-map [26] <- 6