Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
primaryobjects / hotspot-keep-alive.ps1
Last active April 13, 2024 15:53
Script to Enable Windows 10 Mobile Hotspot Automatically After Reboot
# https://superuser.com/a/1434648
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
@ElToro1966
ElToro1966 / r_ubuntu_18_04.sh
Last active October 1, 2023 18:29 — forked from pachadotdev/r_ubuntu_17_10.sh
Install R and RStudio on Ubuntu 18.04 with essential libraries for data science. Based on pachamaltese/r_ubuntu_17_10.sh (for Ubuntu 17.10). Note: You need to make sure the default library location - /usr/local/lib/R/site-packages - is writable .
# Install R
sudo apt update
sudo apt install gdebi libxml2-dev libssl-dev libcurl4-openssl-dev libopenblas-dev r-base r-base-dev
# Install RStudio
cd ~/Downloads
wget https://download1.rstudio.org/desktop/bionic/amd64/rstudio-1.2.5001-amd64.deb
sudo gdebi rstudio-1.2.5001-amd64.deb
printf '\nexport QT_STYLE_OVERRIDE=gtk\n' | sudo tee -a ~/.profile
@s-m-e
s-m-e / svg_text_length.py
Last active July 27, 2021 00:47
A Python (3) class for figuring out the width and height of a formatted svg text.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Loosely based on http://stackoverflow.com/a/28741636/1672565
import subprocess
import struct
import os
//assuming array look like this.
var arr = [
["Status", "Name", "Marks", "Position"],
["active", Sarfaraz, 10.0, "Front-end-dev"],
["active", John, 10.0, "Front-end-dev"],
["deactive", Raganar, 10.0, "UI designer"],
];
console.log (arrToObject(arr));
@yitang
yitang / gist:d6420b695799101f1865
Last active May 31, 2019 05:45
Rcpp point in polygon
#include <Rcpp.h>
using namespace Rcpp;
// ref: http://geomalgorithms.com/a03-_inclusion.html
// Copyright 2000 softSurfer, 2012 Dan Sunday
// This code may be freely used and modified for any purpose
// providing that this copyright notice is included with it.
// SoftSurfer makes no warranty for this code, and cannot be held
// liable for any real or imagined damage resulting from its use.
// Users of this code must verify correctness for their application.
@leeper
leeper / sweave-executable.r
Created November 6, 2013 10:35
R script for Windows, which can be run to fully compile the latest updated .rnw file in a directory.
# Sweave Compilation Shell Script
# Thomas J. Leeper
# Created 2011-08-12
# Updated 2012-08-29
# Copyright (C) 2012 Thomas J. Leeper
# This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
sink("execute.log",split=FALSE,type = c("output", "message")) #Optional save shell script output
@tvwerkhoven
tvwerkhoven / MultiMarkdown_guide.md
Last active December 7, 2020 23:21
Brief introduction to MultiMarkdown highlighting features that were hard to find.
@seltzered
seltzered / IllustratorSaveAsSVGs.jsx
Last active August 1, 2023 17:56
Quick little script to batch-convert Illustrator .ai's to .svg's, based on Adobe's sample 'save to pdf's' script. Save it to a jsx, and load it under illustrator. Intended for Illustrator CS6.
/**********************************************************
ADOBE SYSTEMS INCORPORATED
Copyright 2005-2010 Adobe Systems Incorporated
All Rights Reserved
NOTICE: Adobe permits you to use, modify, and
distribute this file in accordance with the terms
of the Adobe license agreement accompanying it.
If you have received this file from a source
@ryangray
ryangray / buttondown.css
Created February 22, 2012 06:45
A clean, minimal CSS stylesheet for Markdown, Pandoc and MultiMarkdown HTML output.
/*
Buttondown
A Markdown/MultiMarkdown/Pandoc HTML output CSS stylesheet
Author: Ryan Gray
Date: 15 Feb 2011
Revised: 21 Feb 2012
General style is clean, with minimal re-definition of the defaults or
overrides of user font settings. The body text and header styles are
left alone except title, author and date classes are centered. A Pandoc TOC