Skip to content

Instantly share code, notes, and snippets.

View VishwaJay's full-sized avatar

Vishwa Jay VishwaJay

  • Salt Lake City
View GitHub Profile
@VishwaJay
VishwaJay / http_accept_language.php
Created May 31, 2024 18:43 — forked from xeoncross/http_accept_language.php
Parse the HTTP except language header
<?php
function prefered_language($available_languages, $http_accept_language) {
$available_languages = array_flip($available_languages);
$langs = array();
preg_match_all('~([\w-]+)(?:[^,\d]+([\d.]+))?~', strtolower($http_accept_language), $matches, PREG_SET_ORDER);
foreach($matches as $match) {
@VishwaJay
VishwaJay / KiCAD_CopperSpiral_v2.py
Created June 2, 2023 06:39 — forked from JoanTheSpark/KiCAD_CopperSpiral_v2.py
v2 with spin direction and increasing amount of segments per turn for smoother result in outer circles
import sys, os
import shutil
import math
import itertools
from copy import deepcopy
# 0 1 2 3 4 5 6
LIST_elmt = [" ("," (start ",") (end ",") "," (layer ",") ","))"]
#LIST_elmt = [" (gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))"]
#LIST_elmt = [" (segment (start 118.7 106.7) (end 119.4 106.7) (width 0.25) (layer B.Cu) (net 0))"]
@VishwaJay
VishwaJay / .htaccess
Created October 17, 2022 03:56 — forked from heiswayi/.htaccess
Common .htaccess Redirects
# 301 Redirects for .htaccess
# ===========================
# Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
# Redirect an entire site:
Redirect 301 / http://www.domain.com/
# Redirect an entire site to a subfolder
@VishwaJay
VishwaJay / countrycodes.sql
Last active September 9, 2022 15:23
A list of country names and their associated digrams and trigrams, ISO numbers, and international dialing system codes.
-- ISO 3166-2 and International Dialing Codes
-- for MySQL/MariaDB
-- Last Updated: 2019-Jun-16 00:00 UTC
--
-- Table structure for table `countrycodes`
--
DROP TABLE IF EXISTS `countrycodes`;
CREATE TABLE IF NOT EXISTS `countrycodes` (