Skip to content

Instantly share code, notes, and snippets.

View Nirespire's full-sized avatar
💯
.

Sanjay Nair Nirespire

💯
.
View GitHub Profile
package main
import (
"bytes"
"encoding/binary"
"encoding/hex"
"log"
"math/rand"
"strings"
"net"
@Nirespire
Nirespire / ddclient.conf
Last active November 6, 2021 16:00
Raspberry pi minecraft server
Sample ddclient.conf entries:
protocol=dyndns2
use=web
server=domains.google.com
ssl=yes
function testGetUserAge(){
// Mock the responses of the fetch to our API to return some fake data
when(fetch("https://myapi.com/users/123")).thenReturn({dateOfBirth:new Date("06/16/1993")}
when(fetch("https://myapi.com/users/456")).thenReturn({dateOfBirth:new Date("06/16/1994")}
// Assert that given the return value of the api, the function returns the correct value
expect(getUserAge(123, 456)).toEqual(1)
}
function getUserAgeDifference(user1, user2) {
var user1Info = fetch("https://myapi.com/users/" + user1)
var user2Info = fetch("https://myapi.com/users/" + user2)
var ageDifference = user2Info.dateOfBirth - user1Info.dateOfBirth
return ageDifference
}

Google Next 2018

Day 1

Machine learning chatbots

  • Entity extraction
  • Use follow ups to narrow down intent and entity
  • Use native entity recognition models
  • State management
# If your internet is down, quickly find out when it comes back!
# "If you can't connect to Google, it's your fault"
set -x
while true; do
ping www.google.com
sleep 10
done
@Nirespire
Nirespire / webserver.go
Last active January 16, 2018 13:06
Go Static Webserver
package main
import (
"log"
"net/http"
)
func main() {
port := os.Getenv("PORT")
from bs4 import BeautifulSoup
import urllib2
import re
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from time import gmtime, strftime
#!/bin/bash
# Stop deleting this CISE admins. If there's an issue email me.
if [ ! -e "/tmp/steam_$USER/usr/lib/steam/steam.sh" ]; then
rm -rf "/tmp/steam_$USER"
mkdir -p "/tmp/steam_$USER"
cd "/tmp/steam_$USER"
wget 'https://steamcdn-a.akamaihd.net/client/installer/steam.deb' -O 'steam.deb'
dpkg-deb -R steam.deb .