Skip to content

Instantly share code, notes, and snippets.

@dantheman213
dantheman213 / count_lines_of_code_git.sh
Created May 27, 2017 19:06
Count how many lines of code are in git repo
git ls-files | xargs wc -l
@dantheman213
dantheman213 / showrss_downloader.js
Last active July 15, 2021 11:02
showRSS scheduler rss feed parse and download magent link files for your personal showRSS RSS URL
// showRSS scheduler rss feed parse and download magent link files for your personal showRSS RSS URL
// HOW TO USE //
// 1. Setup showRss Feed and get a personal URL
// 2. Setup a torrent downloader (I like Deluge) and have it watch a folder to auto-add torrent_files
// 3. Cron to setup
// * 23 * * * nodejs /usr/bin/showrss_downloader.js >> /var/log/showrss_downloader.log 2>&1
@dantheman213
dantheman213 / elementary_os_install_nvidia.sh
Created June 19, 2021 17:21
Elementary OS Install NVIDIA Graphics Card
# Elementary OS install nvidia graphics drivers
## remove old drivers
sudo apt autoremove nvidia*
## install new drivers
sudo ubuntu-drivers autoinstall
@dantheman213
dantheman213 / HttpGetRequestSync.cs
Created July 30, 2015 23:41
C# HTTP GET request synchronous example
using System.Net.Http;
using (var client = new HttpClient())
{
var url = "http://google.com/api-example";
var response = client.GetAsync(url).Result;
if (response.IsSuccessStatusCode)
{
// by calling .Result you are performing a synchronous call
@dantheman213
dantheman213 / pdf.md
Created March 21, 2021 19:00
Convert PDF into high quality images
@dantheman213
dantheman213 / file.m
Created July 24, 2015 19:59
Recursively list all dirs and files in a iOS app's documents directory
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *bundleURL = [[NSBundle mainBundle] bundleURL];
NSDirectoryEnumerator *enumerator = [fileManager enumeratorAtURL:bundleURL
includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey]
options:NSDirectoryEnumerationSkipsHiddenFiles
errorHandler:^BOOL(NSURL *url, NSError *error)
{
NSLog(@"[Error] %@ (%@)", error, url);
}];
@dantheman213
dantheman213 / average-geolocation.js
Created August 23, 2020 19:16 — forked from tlhunter/average-geolocation.js
Calculate the center/average of multiple GeoLocation coordinates
/**
* Calculate the center/average of multiple GeoLocation coordinates
* Expects an array of objects with .latitude and .longitude properties
*
* @url http://stackoverflow.com/a/14231286/538646
*/
function averageGeolocation(coords) {
if (coords.length === 1) {
return coords[0];
}
@dantheman213
dantheman213 / update_nodejs_npm_linux.sh
Created August 9, 2020 18:13
update_nodejs_npm_linux.sh
Update nodejs to latest version:
sudo npm install -g n
sudo n latest
Update npm to latest version:
sudo npm install -g npm
Do what @runcible suggested
hash -d npm
echo "username ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
@dantheman213
dantheman213 / install_great_gnu_screen_config.sh
Last active May 10, 2020 05:05
Download a great Gnu Screen config straight to your current user's environment
#
# Download a great Gnu Screen config straight to your current user's environment
#
# Just paste that in wherever env you're at and run `screen` and you'll have a good configuration with a status bar,
# tabs, no warning screen, beeps/bells/alerts, and more.
#
# Screen Config (.screenrc) located here:
# Gist: https://gist.github.com/dantheman213/8df6fabb1bc6fc192c9e
# Raw: https://gist.githubusercontent.com/dantheman213/8df6fabb1bc6fc192c9e/raw/bfd65a3695974b94223849c516b5b58828932613/Great%2520GNU%2520Screen%2520config