Skip to content

Instantly share code, notes, and snippets.

View ichadhr's full-sized avatar
Focusing

Chad ichadhr

Focusing
View GitHub Profile
@ichadhr
ichadhr / index.php
Last active October 7, 2019 15:37
PHP Get lat, long from address
// ------------------------------------------
// converts a string with a stret address
// into a couple of lat, long coordinates.
// ------------------------------------------
public function getLatLong($address){
if (!is_string($address))die("All Addresses must be passed as a string");
$_url = sprintf('http://maps.google.com/maps?output=js&q=%s',rawurlencode($address));
$_result = false;
if($_result = file_get_contents($_url)) {
if(strpos($_result,'errortips') > 1 || strpos($_result,'Did you mean:') !== false) return false;
@ichadhr
ichadhr / zues.xml
Last active October 7, 2019 15:41
Zeus modified theme for VS Code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Zeus</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@ichadhr
ichadhr / UnknownSource.md
Last active October 7, 2019 15:40
OS X #UnknownSource

enabled

sudo spctl --master-enable

disabled

sudo spctl --master-disable

@ichadhr
ichadhr / snip_list_numeric_filter.py
Created October 4, 2018 07:50
Remove empty and non numeric from list #python #list #numeric #filtering
# check a list for float type value
def checkListFloat(self, arList, isfloat = False) :
result = []
for _i in arList:
if self.checkFLoat(_i) :
result.append([int(float(_i))])
else :
res = re.sub('[^\d\.,]', '', _i)
if res :
result.append([res])
@ichadhr
ichadhr / snip-tabula.py
Last active October 7, 2019 15:52
Simple use tabula.jar with python #tabula #python
# running tabula
def tabula(jarfile, coordinate, pathFile) :
output = self.launchWithoutConsole('java', ['-jar', str(jarfile), '-p', 'all', '-a', str(coordinate), str(pathFile)])
return output
# Subprocess without console (PyInstaller)
def launchWithoutConsole(command, args):
@ichadhr
ichadhr / READ.md
Last active October 7, 2019 15:42
Automatic run as Administrator
  1. Open Local Security Policy Editor (on the Start screen type "secpol" and click it).
  2. From the menu on the left, expand "Local Policy".
  3. Under the expanded "Local Policy" heading, select "Security Options".
  4. On the panel on the right find "User Account Control: Run all administrators in Admin Approval Mode", open this setting and change the value to Disabled.

Policy Editor

@ichadhr
ichadhr / tld.sh
Last active October 7, 2019 15:43
Checking longest TLD
curl -s http://data.iana.org/TLD/tlds-alpha-by-domain.txt | tail -n+2 | wc -L
@ichadhr
ichadhr / font_char.html
Created December 28, 2017 20:05
Font Character Test
<!DOCTYPE html>
<html>
<head>
<title>Testing Char</title>
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Roboto);
body {
font-family: 'Roboto';
font-size: 18px; padding: 5px;
}
@ichadhr
ichadhr / print.html
Last active August 26, 2023 05:32
Print External Link (HTML / PDF)
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Print External Link</title>
<script type="text/javascript">
function closePrint () {
document.body.removeChild(this.__container__);
}
@ichadhr
ichadhr / download.php
Last active October 7, 2019 15:44
PHP Download
<?php
/* Function: download with resume/speed/stream options */
/*
* Parametrs: downloadFile(File Location, File Name,
* max speed, is streaming
* If streaming - movies will show as movies, images as images
* instead of download prompt
*/
function downloadFile($fileLocation, $fileName, $maxSpeed = 13, $doStream = false)