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
@tesh254
tesh254 / se_email_converter.js
Last active September 12, 2023 12:05
s3_email_converter
import AWS from "aws-sdk";
import fs from "fs";
import { simpleParser } from "mailparser";
import zlib from "zlib";
import { parse } from 'node-html-parser';
export function initAws() {
AWS.config.update({
accessKeyId: process.env.RUA_S3_ACCESS_KEY_ID,
secretAccessKey: process.env.RUA_S3_SECRET_ACCESS_KEY,
@tesh254
tesh254 / keybase.md
Created August 3, 2023 13:12
keybase.md

Keybase proof

I hereby claim:

  • I am tesh254 on github.
  • I am wchr00 (https://keybase.io/wchr00) on keybase.
  • I have a public key ASCuyV8M1lRvIXxBK4sO8CseXdzH5ulsbiF5Dfq_pMQVAwo

To claim this, I am signing this object:

@tesh254
tesh254 / qr_code_generator.ts
Created June 26, 2021 12:40
Generate a custom QR code with the help of node canvas, enabling headless QR generation.
import QRCode from "qrcode";
import { createCanvas, loadImage, CanvasRenderingContext2D, Image } from "canvas";
import { IQrOptions } from "../interfaces";
import SpacesService from "./spaces.service";
export default class QRGeneratorService {
private qrOptions: IQrOptions;
private text: string;
constructor(text: string, options: IQrOptions) {
package main
import (
"net"
"os"
)
func main() {
strEcho := "Halo"
servAddr := "localhost:6666"
tcpAddr, err := net.ResolveTCPAddr("tcp", servAddr)
const express = require("express");
const { lookup } = require("geoip-lite");
const app = express();
const router = express.Router();
router.get("/some-ip", (req, res) => {
const ip = req.headers["x-forwarded-for"] || req.connection.remoteAddress;
@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>",
@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"
)
#!/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:
#!/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
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)