Skip to content

Instantly share code, notes, and snippets.

View tesh254's full-sized avatar
🏠
Working from home

wachira tesh254

🏠
Working from home
View GitHub Profile
import React, { Component } from "react";
import { Table, Button } from "reactstrap";
import ModalForm from "../Modals/Modal";
class DataTable extends Component {
deleteItem = id => {
let confirmDelete = window.confirm("Delete item forever?");
if (confirmDelete) {
fetch("http://localhost:3000/crud", {
method: "delete",
@tesh254
tesh254 / verifyEmailTemplate.js
Created September 16, 2019 14:06
A simple email template to send users with Nodemailer when they need to verify their account
const verifyEmail = (username, email, link) => `
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Password Reset</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
import jwt from "jsonwebtoken"
import config from "../config"
import User from "../models/user.models"
const authorize = (req, res, next) => {
const token = req.headers["authorization"]
if (!token) {
return res.status(403).json({
auth: false,
message: "Please login a user"
const axios = require("axios");
class FetchWeather {
constructor(apiKey) {
this.apiKey = apiKey;
this.locations = ["nairobi"];
}
getWeatherByLocations() {
this.locations.map(location => {
Verifying my Blockstack ID is secured with the address 19r4mRhbadatZSHZU22GbMzSp2qCiLjF8k https://explorer.blockstack.org/address/19r4mRhbadatZSHZU22GbMzSp2qCiLjF8k
const axios = require('axios')
const express = require('express')
const { DateTime } = require('luxon')
require('dotenv').config()
const darkSkyApiKey = process.env.DARK_SKY_API_KEY
const gcpKey = process.env.GCP_KEY
const darkSkyBaseUrl = `https://api.darksky.net/forecast`
const address = process.argv.slice(2)
#!/bin/bash
if [ "$1" == "" ]
then
echo "You forgot an IP address"
echo "Syntax: ./ipsweep.sh 192.168.111"
else
for ip in `seq 1 254`; do
ping -c 1 $1.$ip | grep "64 bytes" | cut -d " " -f 4 | tr -d ":" &
done
#!/bin/python3
import sys # Allows us to enter command line arguments
import socket
from datetime import datetime
# Define our target
if len(sys.argv) == 2:
target = socket.gethostbyname(sys.argv[1]) # Transalate a host name to ipv4
else:
@tesh254
tesh254 / scraper.go
Last active December 14, 2020 07:15
Scrape website and get meta tags data
package scrapper
import (
"fmt"
// "io/ioutil"
"net/http"
"time"
"github.com/PuerkitoBio/goquery"
)
@tesh254
tesh254 / tweet.json
Created December 31, 2020 10:19 — forked from dustinrouillard/tweet.json
carp
{
"created_at": "Sat Dec 19 02:22:35 +0000 2020",
"id_str": "1340120314898857984",
"full_text": "carp",
"display_text_range": [
0,
4
],
"entities": {},
"source": "<a href=\"https://mobile.twitter.com\" rel=\"nofollow\">Twitter Web App</a>",