Skip to content

Instantly share code, notes, and snippets.

@peterhel
peterhel / bash
Last active August 29, 2015 14:05
Useful bash commands
#Find files in subdirs and move to one location
#http://www.cyberciti.biz/faq/linux-unix-bsd-xargs-construct-argument-lists-utility/
$ find /path/to/dir -iname "*.c" -print0 | xargs -0 -I file mv file ~/old.src
@peterhel
peterhel / List modules
Created August 19, 2014 21:50
Print modules used in build
sudo opensnoop | grep develop/node_modules > modules.txt
cat modules.txt | awk '{print $5}' | awk -F'/' '{print $8}' | sort | uniq
@peterhel
peterhel / nginx.conf
Last active August 29, 2015 14:13
Nginx prerender
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
@peterhel
peterhel / gist:cfa62191274436397cd1
Created April 6, 2015 20:59
Send Facebook message from command line
var page = require('webpage').create();
var system = require('system');
var args = system.args;
var queue = [];
function done() {
if(queue.length == 0) {
phantom.exit();
}

Modify the installation medium to boot on 32-bit UEFI

  • Get a bootia32.efi file, I used this one from John Wells.
  • Copy the file into the EFI/BOOT/ folder on the boot medium.
var cloudinary = require('cloudinary');
cloudinary.config({
cloud_name: '',
api_key: '',
api_secret: ''
});
exports.save = function(req, callback) {
console.log(req.body)
@peterhel
peterhel / node-update-outdated-modules.sh
Created January 29, 2016 12:09
_Updates all outdated node modules. Either in the current `./node_modules` or globally depending on your working dir.
npm outdated | grep -v 'git' | awk 'NR>1{print "npm i -g "$1"@"$3}' | xargs -I {} bash -c '{} | cat'
int InetGSM::httpPOST(const char* server, int port, const char* path, const char* parameters, char* result, int resultlength)
{
boolean connected=false;
int n_of_at=0;
char itoaBuffer[8];
int num_char;
char end_c[2];
end_c[0]=0x1a;
end_c[1]='\0';
/*
This a simple example of the aREST Library for the ESP8266 WiFi chip.
See the README file for more details.
Written in 2015 by Marco Schwartz under a GPL license.
*/
// Import required libraries
#include <ESP8266WiFi.h>
#include <aREST.h>
#!/usr/bin/env bash
set -o errexit
# set -o nounset
set -o pipefail
if [ "$(whoami)" = "root" ]
then
echo "Run as default user instead of root!"
exit 1