Skip to content

Instantly share code, notes, and snippets.

@aaronthorp
aaronthorp / chrome.psh
Created May 11, 2020 07:21
Download Chrome Powershell
$Path = $env:TEMP; $Installer = "chrome_installer.exe"; Invoke-WebRequest "http://dl.google.com/chrome/install/375.126/chrome_installer.exe" -OutFile $Path\$Installer; Start-Process -FilePath $Path\$Installer -Args "/silent /install" -Verb RunAs -Wait; Remove-Item $Path\$Installer
{
"packages": [
{
"name": "esp32",
"maintainer": "Espressif Systems",
"websiteURL": "https://github.com/espressif/arduino-esp32",
"email": "[email protected]",
"help": {
"online": "http://esp32.com"
},
@aaronthorp
aaronthorp / gist:f69e0e32f56805e4b8ee
Last active August 24, 2018 04:51
Install Chrome from PowerShell
(new-object System.Net.WebClient).DownloadFile('https://dl.google.com/chrome/install/latest/chrome_installer.exe', 'chrome.exe');.\chrome.exe /silent /install;rm chrome.exe
#/bin/bash
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
sudo apt-get update
sudo apt-get install iptables-persistent
server {
listen 80 default;
# server_name _;
root /app;
index index.php index.html index.htm;
location / {
# First attempt to serve request as file, then
# as directory, then trigger 404
@aaronthorp
aaronthorp / regex_search.js
Created June 26, 2015 01:28
regex_search.js
function buildRegExp(searchText) {
var words = searchText.trim().split(/[ \-\:]+/);
var exps = _.map(words, function(word) {
return "(?=.*" + word + ")";
});
var fullExp = exps.join('') + ".+";
return new RegExp(fullExp, "i");
}
@aaronthorp
aaronthorp / ec2_root.sh
Last active August 29, 2015 14:22
Amazon allow root access for mup
ssh ubuntu@HOSTNAME 'sudo cp /home/ubuntu/.ssh/authorized_keys /root/.ssh/'
@aaronthorp
aaronthorp / useridea.js
Created May 28, 2015 07:33
template level meteror method for user details select
Template.chatItem.onCreated(function() {
var instance = Template.instance();
instance.member = new ReactiveVar();
instance.autorun(function() {
var id = this.userId;
Meteor.call('getMember', id, function(err, data) {
instance.member.set(data);
});
});
});
@aaronthorp
aaronthorp / dump.sh
Created April 10, 2015 02:01
Dump all MySQL to seperate files
mkdir ~/db && mysql -s -r -u root -p{Secret} -e 'show databases' | while read db; do mysqldump -u root -p{Secret} $db -r ~/db/${db}.sql; [[ $? -eq 0 ]] && gzip ~/db/${db}.sql; done
@aaronthorp
aaronthorp / blaze.js
Created March 26, 2015 12:14
blaze-parentTemplate.js
/**
* Get the parent template instance
* @param {Number} [levels] How many levels to go up. Default is 1
* @returns {Blaze.TemplateInstance}
*/
Blaze.TemplateInstance.prototype.parentTemplate = function (levels) {
var view = Blaze.currentView;
if (typeof levels === "undefined") {
levels = 1;