Skip to content

Instantly share code, notes, and snippets.

View tommyready's full-sized avatar
🎯
Focusing

Tommy Ready tommyready

🎯
Focusing
  • Charleston, SC
View GitHub Profile
@unalman
unalman / CloudFlareApiClient.cs
Created August 29, 2019 12:51 — forked from tommyready/CloudFlareApiClient.cs
Update Cloud Flare DNS Record via Cloud Flare API v4 using C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using Newtonsoft.Json;
namespace CloudFlareApiClient
{
class Program
{
@rasyadhs
rasyadhs / csv-to-mysql.py
Created August 23, 2019 05:08 — forked from radaniba/csv-to-mysql.py
Python CSV to MySQL
#!/usr/bin/env python
# Run with no args for usage instructions
#
# Notes:
# - will probably insert duplicate records if you load the same file twice
# - assumes that the number of fields in the header row is the same
# as the number of columns in the rest of the file and in the database
# - assumes the column order is the same in the file and in the database
#
@lucky-c
lucky-c / app.js
Last active May 6, 2024 13:13
React Native: Expo video HLS streaming sample
import React from 'react';
import { StyleSheet, Text, View, Dimensions } from 'react-native';
import { Video } from 'expo';
export default class App extends React.Component {
render() {
// Set video dimension based on its width, so the video doesn't stretched on any devices.
// The video dimension ratio is 11 : 9 for width and height
let videoWidth = Dimensions.get('window').width;
@jonathansanchez
jonathansanchez / LaravelLogger.php
Last active July 19, 2018 16:12
Passing Request object to Infrastructure Service on Laravel 5.4
<?php namespace App\Infrastructure\Logging\Laravel;
use App\Infrastructure\Logging\Logger;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
final class LaravelLogger implements Logger
{
/** @var Request */
private $request;
@TwiN
TwiN / [PYTHON]file_get_contents(URL).py
Last active August 22, 2022 22:44
Python equivalent of PHP's file_get_contents on websites (NOT LOCAL FILES)
import urllib2,cookielib
'''
Function that returns the source from the target url
@param url
'''
def file_get_contents(url):
url = str(url).replace(" ", "+") # just in case, no space in url
hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
@aliang
aliang / Mac SSH Autocomplete
Created June 14, 2011 07:14
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;