Skip to content

Instantly share code, notes, and snippets.

@illuzian
illuzian / luz.zsh-theme
Last active August 29, 2015 13:55
Python ZSH Theme With Pure Awesome by Luz
# ------------------------------------------------------------------------
# Anthony Hawkes who totally ripped off junkfood by
# Tyler Cipriani who ripped off
# Totally ripped off Dallas theme
# Anthony Hawkes - Totally modified the code/variables and layour to make
# it more human readable and obvious/less of a fluster cuck. Seperation
# of interests and all that.
# Also made it more pythonated as it'as better(my opinion, but true)
# ------------------------------------------------------------------------
@illuzian
illuzian / 0_reuse_code.js
Created July 26, 2014 11:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import json
import urllib
from PIL import Image
import cStringIO
map_data = "https://static.mwomercs.com/data/cw/mapdata.json"
data = json.load(urllib.urlopen(map_data))
#Hypothetical models.py
from django.db import models
class Something(models.Model):
name = models.CharField(max_length=40)
some_number = models.IntegerField(max_length=5)
#Now you would magically create the table(s) with `python manage.py makemigrations; python manage.py migrate`
#Hypothetical other file accessing the model
class SomeClass(object):
def __init__(self, param1=False, param2=False):
self.param1 = param1
self.param2 = param2 #set some variables you could pass in at instantiation eg a = SomeClass(param1=5, param2=6)
# Make some empty variables you plan to use later:
self.some_array = []
self.some_dict = {}
from Tkinter import *
from ttk import *
import urllib
import csv
import operator
from collections import OrderedDict
class Lotto(object):
def __init__(self, url='http://dev-spook/callcentre/jason/MondayLotto-05-01-2015-19-02.csv'):
@illuzian
illuzian / reference.rs
Created August 27, 2017 12:06
Rust code with comments describing references for modification of a value
fn main() {
// This function modifies the values passed in
// Takes in a Vec with types i32 as a reference & and mutable
fn addition(in_vec: &mut Vec<i32>) {
// We've already referenced in_vec so no need for &
for x in in_vec {
// We need to dereference using *
*x = *x + 10;
}
@illuzian
illuzian / quick_reference.pq
Last active February 11, 2022 17:54
Power BI M/Power Query Reference
/*
Copyright 2020 Anthony Hawkes
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
# This script first clears the CRL cache in the event a proxy CA, internal CA, scanning tool CA or AV CA gets trusted for
# something it shouldn't and your mac won't accept the genuine certificate.
# After clearing the CRL cache this script shreds the App Store caches - probably restart after and try downloading from the
# App Store again.
# If it doesn't fix your problem.... well good luck, may Google be by your side.
# Clear crl and oscp cache
sudo rm /var/db/crls/*.db
@illuzian
illuzian / multi_whois.sh
Last active September 14, 2020 00:04
One liner to perform multiple whois or whois and ptr/reverse lookups against multiple targets froma file.
# One liner. The input file should contain one entry per line.
# `grep -i -E '(OrgName|Country)'` can be removed to show all of the whois output or modified to select preferred items.
cat lookupips.txt | while read ip; do echo $ip; whois -H $ip | grep -i -E '(OrgName|Country)'; done
# Same but includes a ptr lookup - change 1.1.1.1 to whichever server you want to use or remove to use your local server.
cat lookupips.txt | while read ip; do echo $ip; nslookup $ip 1.1.1.1 | grep -o -E 'name = .*$'; whois -H $ip | grep -i -E '(OrgName|Country)'; done