Skip to content

Instantly share code, notes, and snippets.

View mwrites's full-sized avatar
🔧

Supermercat mwrites

🔧
View GitHub Profile
@mwrites
mwrites / .vimrc
Last active October 12, 2021 18:51
Server Config - Ubuntu - vimrc
set number
set linebreak
set showbreak=+++
set textwidth=100
set showmatch
set visualbell
set hlsearch
set smartcase
set ignorecase
@mwrites
mwrites / curl.md
Created August 18, 2021 11:10 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@mwrites
mwrites / slicing.py
Created August 8, 2021 08:09
Python - Slicing
nums = [1, 2, 3, 4]
# ***********************************
# Slicing
# ***********************************
# Syntax is
# slice(start, stop, step)
@mwrites
mwrites / dictionary.py
Last active October 12, 2021 18:38
Python - Dictionary
phone_book = {"Batman": 468426,
"Cersei": 237734,
"Ghostbusters": 44678}
# ************************
# Enumeration
# ************************
for k in phone_book: # give keys
# Batman
@mwrites
mwrites / defaultdict.py
Last active October 12, 2021 18:35
Python - Dictionary With Default Values
hashmap = {
'vegetables': ['Carrot', 'Tomato'],
'fruits': ['Apple', 'Banana']
}
# **************
# Default Values
# **************
hashmap['missing_key'] # KeyError
@mwrites
mwrites / dict_to_nametuple.py
Created August 2, 2021 06:57
Python convert dictionary to namedtuple
from collections import namedtuple
Parts = {'id_num':'1234', 'desc':'Ford Engine',
'cost':1200.00, 'amount':10}
parts = namedtuple('Parts', Parts.keys())(**Parts)
print (parts)
#Parts(amount=10, cost=1200.0, id_num='1234', desc='Ford Engine')
@mwrites
mwrites / android_instructions.md
Created February 6, 2020 19:53 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@mwrites
mwrites / Bridge.mm
Last active October 18, 2019 10:24
Bridge.mm
//
// Bridge.m
// Unity-iPhone
//
// Created by Mathieu Tan on 2019/10/17.
//
#import "UnityString_C++.h"
#import "UnityInterface.h"
extension CustomStringConvertible {
var description : String {
var description: String = ""
if self is AnyObject {
description = "***** \(type(of: self)) - <\(unsafeAddressOf((self as! AnyObject)))>***** \n"
} else {
description = "***** \(type(of: self)) *****\n"
}
let selfMirror = String(reflecting: self)
@mwrites
mwrites / InspectCaller.py
Created February 6, 2019 14:19
Python get function caller
import inspect
def f1(): f2()
def f2():
print 'caller name:', inspect.stack()[1][3]
f1()