Skip to content

Instantly share code, notes, and snippets.

View stefco's full-sized avatar
😳

Stefan Countryman stefco

😳
View GitHub Profile
@stefco
stefco / cpuinfo.c
Created July 19, 2020 06:34 — forked from bellbind/cpuinfo.c
[c][intel][clang] get cpu info from CPUID intrinsic in clang/gcc
// intel CPUID opcode
// see: https://en.wikipedia.org/wiki/CPUID
// clang -Wall -Wextra -std=c11 cpuinfo.c -o cpuinfo
#include <stdint.h>
#include <stdio.h>
#include <cpuid.h> //macro __cpuid(eaxin, eaxout, ebx, ecx, edx)
int main() {
{
@stefco
stefco / send_an_email.py
Created March 5, 2019 23:35 — forked from yzhong52/send_an_email.py
Send an email with a gmail account using python 3
# smtplib module send mail
import smtplib
TO = 'recipient@mailservice.com'
SUBJECT = 'TEST MAIL'
TEXT = 'Here is a message from python.'
# Gmail Sign In
gmail_sender = 'sender@gmail.com'
@stefco
stefco / facebook-contact-info-summary.rb
Created September 11, 2018 20:19 — forked from dylanmckay/facebook-contact-info-summary.rb
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# NOTE: Requires Ruby 2.1 or greater.
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
@stefco
stefco / vimtex_workflow.txt
Created July 17, 2018 05:41 — forked from bagrow/vimtex_workflow.txt
Some details for my macvim/skim/latexmk workflow
MacVim + latexmk + Skim workflow:
MacVim http://code.google.com/p/macvim/
Latexmk http://www.phys.psu.edu/~collins/software/latexmk-jcc/
Skim.app http://skim-app.sourceforge.net/
Open the texfile in macvim:
$ mvim <file>.tex
Watch tex file with latexmk (see also ~/.dotfiles/latexmkrc):
$ latexmk -pdf -pvc <file>.tex
@stefco
stefco / instagram_id_to_url.php
Created May 28, 2018 08:10 — forked from stirtingale/instagram_id_to_url.php
Simple PHP function to convert an Instagram ID into a URL.
// based on ggwarpig stackoverflow anwser to
// "Where do I find the Instagram media ID of a image"
// @ https://stackoverflow.com/a/37246231
function instagram_id_to_url($instagram_id){
$url_prefix = "https://www.instagram.com/p/";
if(!empty(strpos($instagram_id, '_'))){
@stefco
stefco / camphor.scss
Created December 4, 2017 05:12 — forked from bdno86/camphor.scss
camphor
$camphor300:'d09GMgABAAAAAQ5UABIAAAAEn0QAAQ3tAAEZmQAAAAAAAAAAAAAAAAAAAAAAAAAAG4SkahzOKgZgFotgAIosCCIJgnMRCAqLlgCKvTwBNgIkA5lwE4GnDguZdAAEIAW7bwcgDHJb0WS0WUXZkokWaBHx4wKbY7TigANIU/t980QCGzI/IkCsdbqJZwY1ZOgWDngIamw3I43435Dd+zJ1kNmKVp/DvXNAwaNm//////////////////+/NZkMZ5cAl0CpbZ3oiwloFA5GyIWNzOYVLt1bpXPX+pABI2fo5rMZpgVYIzYqgxt92ajECqUKh2G9gaOCVRC23VSRVypHfbvb7wYcwEM25WArF0esm1yKzDixrJRdcBGtcpBZTFbFbIl8LIU4gWOnEdSITqkoGrHWJ8ywn9eVFWWk3lC6m07qp1TXntHaWp6ekYHLrFoyzOXYiQnn2kWX2zqMaFBTca25vHKndPhJV66HRhQzL9lB3OT20KGTXuFHu62wm1qzoV/iTnaiLdc8o/D7B+1O94BrjSE3cia6U1A5XNp0kHmUj8IMBaeiGaiNJV7b1csb0bq8EWYo2h1TuipR+7hmYjxeZsonGLNcmgsKp5EUDCEj9SvRyxX2uMUNfINmfNqglBYNNtjtNmdwWV2ly4uQKheyDyka2RTRoQ3IEfs+0BNcGJ4Z5AnmHNpFbCKW5PsXkAzJ6VVzzVMo0fwIUpQQT67itTNRE946/NxDashl9KuAFUbZ6yW91vObh+WAMZ1mQ1J4wotF6KXHuo65X6wSz406hW/T6XZMf/6W+HGYUxCDfhyjPaoMGcWccmbYM/H35NdHTOd79Jg0ho/BDBvRy2vcg8pHsv07UYiKrDFeqzL0Qk7qCkXLuukl2EKuR3xS6VtsLEaT0BfWoDYoQ1YvEjjT729XNMYoCX3j+2ApedBG/UHLOJ7AAnfPSqdmmePsY+522MpfPaf7kf6fIJMn0/4SE6PmuI3yjyeGjWn+1qj/ukf09DE
@stefco
stefco / New-iTerm-Window.scpt
Created October 1, 2017 20:42 — forked from reyjrar/New-iTerm-Window.scpt
AppleScript to Open a New iTerm Window and bring it to the front
(*
* New-iTerm-Window.scpt
*
* Intended for use with QuickSilver
* I mapped option-y to running this script to create
* a new iTerm window on the current workspace
*
* Based on much Googling - very little "original" code here
* Comments/Suggestions to brad.lhotsky@gmail.com
*)
@stefco
stefco / aliases
Created September 25, 2017 15:12 — forked from kaleb/aliases
Gmail on Mutt
#~/.mutt/aliases
alias nick Nicholas Levandoski <nick.levandoski@auglug.org>
alias tim Timothy Pitt <timothy.pitt@auglug.org>
alias steven Steven Jackson <sjackson@auglug.org>
alias kaleb Kaleb Hornsby <kaleb.hornsby@auglug.org>
alias alug-admin nick, tim, steven
@stefco
stefco / spacemacs-keybindings
Created September 18, 2017 03:15 — forked from adham90/spacemacs-keybindings
spacemacs keybindings that i need to learn
SPC s c remove highlight
**** Files manipulations key bindings
Files manipulation commands (start with ~f~):
| Key Binding | Description |
|-------------+----------------------------------------------------------------|
| ~SPC f c~ | copy current file to a different location |
| ~SPC f C d~ | convert file from unix to dos encoding |
| ~SPC f C u~ | convert file from dos to unix encoding |
@stefco
stefco / run-python-command-in-shell.sh
Last active September 13, 2017 17:40
Run indented python code in a shell function so that things look nice and readable.
# a template that does nothing. the actual python script is 100% indented.
foo() {
python -c 'import textwrap; exec(textwrap.dedent(r"""
import sys
# remove the first argument, since it will just be '-c'
sys.argv.pop(0)
# put your actual code below
"""+" "*4))' "$@"
}