Skip to content

Instantly share code, notes, and snippets.

View ukor's full-sized avatar
💭
Making things work

Ukor Jidechi E. ukor

💭
Making things work
View GitHub Profile
@ukor
ukor / gist:e594c65997204b25b44b3163ccfddda1
Last active October 1, 2024 08:37
mkcert fullchain certificate
- create cert
```
mkcreate localhost 127.0.0.1 ::1
```
- Create fullchain cert
See - https://github.com/FiloSottile/mkcert/issues/214
@ukor
ukor / file_magic_numbers.md
Created September 7, 2023 14:05 — forked from leommoore/file_magic_numbers.md
File Magic Numbers

File Magic Numbers

Magic numbers are the first bits of a file which uniquely identify the type of file. This makes programming easier because complicated file structures need not be searched in order to identify the file type.

For example, a jpeg file starts with ffd8 ffe0 0010 4a46 4946 0001 0101 0047 ......JFIF.....G ffd8 shows that it's a JPEG file, and ffe0 identify a JFIF type structure. There is an ascii encoding of "JFIF" which comes after a length code, but that is not necessary in order to identify the file. The first 4 bytes do that uniquely.

This gives an ongoing list of file-type magic numbers.

Image Files

[See Stackoverflow Question](https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac)
Add this to your profile
```sh
findAndKillPort() {
port=$(lsof -n -i4TCP:$1 | grep LISTEN | awk '{ print $2 }') kill -9 $port
}
```
@ukor
ukor / default HTTP
Created May 17, 2022 11:27 — forked from iam-hussain/default HTTP
Serve nextJS app from a port through NGINX reverse proxy HTTP and HTTPS
# Serve nextJS app from a port through NGINX reverse proxy (HTTP)
# Path: /etc/nginx/sites-available/default
# Default server configuration for HTTP
server {
server_name www.DOMAINNAME.com DOMAINNAME.com;
# Serve any static assets with NGINX
location /_next/static {
alias /home/ubuntu/PROJECT_FOLDER/.next/static;
@ukor
ukor / is_installed.sh
Created April 28, 2022 14:41 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
SQUASH COMMIT
git checkout yourBranch
git reset --soft HEAD~$(git rev-list --count HEAD ^MAIN_BRANCH_NAME)
git add -A
git commit -m "one commit on yourBranch"
from os import listdir, rename
from os.path import isfile, join
import simplejson as json
import ijson
def read_file(file_path):
print(file_path)
with open(file_path, "rb") as _file:
obj = ijson.items(_file, "features.item")
@ukor
ukor / chat-frontend.js
Created January 1, 2018 03:49 — forked from martinsik/chat-frontend.js
Node.js chat frontend and server
$(function () {
"use strict";
// for better performance - to avoid searching in DOM
var content = $('#content');
var input = $('#input');
var status = $('#status');
// my color assigned by the server
var myColor = false;