Skip to content

Instantly share code, notes, and snippets.

Mike Acton macton

Block or report user

Report or block macton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@macton
macton / cgi-proxy.c
Created Feb 5, 2012
Quick and dirty cgi proxy in C using curl
View cgi-proxy.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ccgi.h>
#include <curl/curl.h>
static size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
size_t i;
@macton
macton / chromebook_tips.txt
Last active Apr 4, 2016
Random tidbits for Chromebook
View chromebook_tips.txt
---------------------------------------------------------------------------------------------------
Turn off power down on time out
Turn off power down on lid close
$ sudo stop powerd
---------------------------------------------------------------------------------------------------
Open port 22 for ssh
$ sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
---------------------------------------------------------------------------------------------------
Set hostname
$ sudo hostname <new-hostname>
@macton
macton / 00 win8_tips.txt
Last active Dec 23, 2016
Windows 8 Tips
View 00 win8_tips.txt
Tips for Windows 8
View vim_tips.txt
----------------------------------------------------------------------------------------------------------------
Find & Replace non-printable characters in vim
http://durgaprasad.wordpress.com/2007/09/25/find-replace-non-printable-characters-in-vim/
1) Find hexa value of that non-printable character. Move your cursor to that character and press ‘ga’.
2) In escape mode, execute this ‘:%s/\%x85/\r/gc’. In my case, hexadecimal value of that non-printable character is 85. I replaced that with ‘\r’.
----------------------------------------------------------------------------------------------------------------
@macton
macton / linux_tips.txt
Last active Dec 13, 2015
Random Linux tips
View linux_tips.txt
-------------------------------------------------------------------------------------------------------------
View process memory info
$ cat /proc/<process_id>/smaps
-------------------------------------------------------------------------------------------------------------
Overall memory info
http://stackoverflow.com/a/13754307
$ smem
-------------------------------------------------------------------------------------------------------------
View .bash_profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@macton
macton / 00_webapp_tips.txt
Last active Jul 18, 2019
random webapp tips
View 00_webapp_tips.txt
Cross-domain file load in jsfiddle
http://jsfiddle.net/jgpSy/
------------------------------------------------
Using jquery.treeview + angular.js
- Dynamically loading json description of tree
- Building DOM with angular
- Calling $.treeview after DOM contructed.
500 items: http://jsfiddle.net/eaq2V/
5000 items: http://jsfiddle.net/Qkh9y/
View README.md

Run like so:

node gist-clone-all.js username

You'll want to replace "username" with your own username.

This script clones using the push URL, so you should probably be the owner of the gists. You could also use this to clone someone else's gists, but in that case you may wish to edit the code to use gist_pull_url instead.

@macton
macton / smbmount
Last active Oct 28, 2016
smb mount linux
View smbmount
References:
[0] http://www.tldp.org/HOWTO/SMB-HOWTO-8.html
[1] http://www.cyberciti.biz/tips/how-to-mount-remote-windows-partition-windows-share-under-linux.html
[2] http://stackoverflow.com/questions/6734400/what-does-cifs-mount-failed-w-return-code-22-indicate
debian
$ sudo apt-get install smbclient
$ sudo apt-get install cifs-utils
$ sudo mkdir /mnt/something
$ sudo mount -t cifs //host/something -o username=user@domain.com,password=psswd /mnt/something
@macton
macton / cpuid_features.c
Last active Aug 20, 2019
Print cpuid features
View cpuid_features.c
// See: Intel Intrinsics Guide https://software.intel.com/sites/landingpage/IntrinsicsGuide/
// See: CPUID Explorer http://www.flounder.com/cpuid_explorer1.htm
// See: Playing with cpuid http://newbiz.github.io/cpp/2010/12/20/Playing-with-cpuid.html
// See: MSDN __cpuid, __cpuidex http://msdn.microsoft.com/en-us/library/hskdteyh.aspx
// See: Notes on MMX/SSE and a searchable table of intrinsics. http://www.taffysoft.com/pages/20120418-01.html
// See: AMD CPUID Specification http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2012/10/25481.pdf
#if defined(__GNUC__)
#include <stdint.h>
#include <cpuid.h>
You can’t perform that action at this time.