Skip to content

Instantly share code, notes, and snippets.

Avatar

bmcculley

View GitHub Profile
View dnsmasq-domains.txt
This file has been truncated, but you can view the full file.
address=/01mspmd5yalky8.com/0.0.0.0
address=/01mspmd5yalky8.com/::1
address=/0byv9mgbn0.com/0.0.0.0
address=/0byv9mgbn0.com/::1
address=/analytics.247sports.com/0.0.0.0
address=/analytics.247sports.com/::1
address=/www.analytics.247sports.com/0.0.0.0
address=/www.analytics.247sports.com/::1
address=/2no.co/0.0.0.0
@bmcculley
bmcculley / server.c
Created Jun 12, 2020
example c server
View server.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <err.h>
View menu_query.sql
SELECT DISTINCT d.roleuser,
a.rolename,
b.classid AS PERMISSION_LIST,
b.menuname,
b.baritemname AS "COMPONENT NAME",
b.pnlitemname,
c.descr AS "PAGE DESCRIPTION",
Decode(b.displayonly, 1, 'Y',
'N') AS "DISPLAY ONLY?",
e.navigation
View stdout_stderr.cpp
#include <iostream>
#include <thread>
#include <chrono>
using namespace std;
int main(int argc, char const *argv[])
{
cout << "Hello, world";
this_thread::sleep_for (chrono::seconds(5));
cerr << "this is an error";
@bmcculley
bmcculley / index.html
Created Oct 11, 2019
Narrow Jumbotron Template for Bootstrap 4
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="bmcculley">
<meta name="generator" content="e42.xyz">
<title>Narrow Jumbotron Template for Bootstrap 4</title>
@bmcculley
bmcculley / example.py
Created Sep 28, 2019
An example of running a shell command from python and capturing its output.
View example.py
import subprocess
MyOut = subprocess.Popen(['ls', '-l', '.'],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout,stderr = MyOut.communicate()
if stdout:
print(stdout.decode('utf-8'))
View et2gNy1MgjD.go
package main
import (
"fmt"
"log"
"net/url"
"strings"
)
func ParseHostname(domain string) []string {
@bmcculley
bmcculley / dns_server.py
Created Jun 26, 2019
An example DNS server using twisted.
View dns_server.py
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
An example demonstrating how to create a custom DNS server.
The server will calculate the responses to A queries where the name begins with
the word "workstation".
Other queries will be handled by a fallback resolver.
@bmcculley
bmcculley / how-to-copy-aws-rds-to-local.md
Last active May 22, 2019 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
View how-to-copy-aws-rds-to-local.md
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
    • the database is restored
View palindrome.py
strings = {
"s1" : "babad",
"s2" : "cbbd",
"s3" : "",
"s4" : "ac",
"s5" : "abb",
"s6" : "ccd",
"s7" : "adam",
"s8" : "ccc",
"s9" : "caba",
You can’t perform that action at this time.