Skip to content

Instantly share code, notes, and snippets.

@epk
epk / .js
Last active April 1, 2018 16:39
router.post('/addPost', function (req, res, next) {
Users.findOne({ "username": req.session.userName }, "canPost", function (Err, doc) {
if (doc.canPost && req.session.userName) {
console.log("first if - VALID");
var newPost = Posts({
username: req.session.userName,
theMessage: req.body.message,
timeStamp: Date().toString()
});
console.log("Created Post - VALID");
type Payload struct {
ID string `json:"Id"`
Title string `json:"title"`
Type string `json:"type"`
Fields Fields `json:"fields"`
}
type Fields struct {
FixVersion []FixVersion `json:"fixVersions"`
}
@epk
epk / random.go
Last active August 5, 2018 03:58
token, err := postAndPoll(client, &data)
if err != nil {
if err.Error() == "failed" {
token, err = postAndPoll(client, &data)
if err != nil {
return nil
}
}
}
var msgCheck = setInterval(fetch, 5e3);
function fetch() {
var n = new XMLHttpRequest;
n.onreadystatechange = function(e) {
if (4 == this.readyState && 200 == this.status) {
var t = JSON.parse(n.responseText);
console.log(t),
addtoDOM(t)
}
}
@epk
epk / autocomplete.js
Last active August 26, 2018 21:05
autocomplete.js
function autocomplete(query) {
var answer = [];
mixmaxFeatures.forEach(function(feature){
let counter = 0;
query.toLowerCase().split(' ').forEach(function(word){
feature.toLowerCase().split(' ').forEach(function(featureWord){
if (featureWord.startsWith(word)){
counter++;
}
})
@epk
epk / Iterm.log
Created September 25, 2018 03:26
Precise timers [driver 2]: updateDisplay interval:
[ 16, 443) 96 ( 99.0%) |********************
[ 443, 871) 0 ( 0.0%) |
[ 871, 1298) 0 ( 0.0%) |
[ 1298, 1725) 0 ( 0.0%) |
[ 1725, 2153) 0 ( 0.0%) |
[ 2153, 2580) 0 ( 0.0%) |
[ 2580, 3007) 0 ( 0.0%) |
[ 3007, 3435) 0 ( 0.0%) |
[ 3435, 3862) 0 ( 0.0%) |
@epk
epk / pi-hole.sh
Last active September 26, 2018 20:33
#!/bin/bash
mkdir -p /home/pi/pi-hole/pihole &&
mkdir -p /home/pi/pi-hole/dnsmasq.d &&
cd /home/pi/pi-hole &&
docker run -d \
--name pihole \
--restart=always \
--dns=1.1.1.1 \
--dns=8.8.8.8 \
-p 53:53/tcp -p 53:53/udp -p 80:80 -p 443:443 \
//---------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
//---------------------------------------------------------------------------------
static const int WORK_SIZE = 200000000;
static const int BLK_SIZE = 256;
using namespace std;
false
Int!
true
true
false
Int!
false
ID!
true
@epk
epk / itme.gif
Created July 4, 2019 02:52 — forked from ewdurbin/itme.gif
itme.gif