Skip to content

Instantly share code, notes, and snippets.

View naamancampbell's full-sized avatar

Naaman Campbell naamancampbell

  • Brisbane, Australia
View GitHub Profile
@tanyagupta
tanyagupta / and_example_json_data.js
Last active October 28, 2017 11:23
Accessing heterogenous JSON data (using &&) - Part 4
function test_and(){
var cars=[
{make: "Jeep",model: "Cherokee",trim:"Sport 4dr Front-wheel Drive",year:"2016",wheel:{wheel_size:"17 x 7.5",wheel_metal:"Aluminum"}},
{make: "Jeep",model: "Wrangler",trim:"Sahara 2dr 4x4",year: "2015"}
]
for (var i in cars){
if (cars[i]["wheel"] && cars[i]["wheel"]["wheel_size"]){
-- /usr/local/pgsql/bin/psql postgres://citus:o8PyA_-OFBq6cQO88gfipw@c.fx2kdxziaw5epni332ukk4al72q.db.citusdata.com:5432/citus?sslmode=require
-- get the latest commits from the top 5 contributors in a particular repo
PREPARE latest_commits(text) AS
WITH postgres_commits AS (
SELECT
created_at, jsonb_array_elements(payload->'commits') AS comm
FROM
@johnrey1
johnrey1 / gist:8344393
Last active April 25, 2018 00:20
powershell script to grant myself basic access to all security groups in my AWS instance
#begin work C:\users\[YOURNAME]\desktop\awssecgroup.ps1 -rdp -mssql -setAws -accessKey "" -secretKey "" -region "us-west-1"
#end work C:\users\[YOURNAME]\desktop\awssecgroup.ps1 -revoke -rdp -mssql -setAws -accessKey "" -secretKey "" -region "us-west-1"
param(
[switch]$rdp,
[switch]$mssql,
[switch]$mysql,
[switch]$ssh,
[switch]$all,
[switch]$revoke,
---
- hosts: docker
tasks:
- command: "echo {{ item }}"
register: result
with_items:
- 1dag
- 2
- 3
- debug:
@marwan-nwh
marwan-nwh / git-aware-bash-prompt.md
Created September 3, 2019 23:42 — forked from eliotsykes/git-aware-bash-prompt.md
Git Aware Bash Prompt
@rafaeldcastro
rafaeldcastro / storage.service.ts
Last active August 15, 2021 09:04
Angular - Ionic | Storage service using @ionic/storage. Wich is a reasonable abstraction to use IndexedDB
import { Injectable } from '@angular/core';
import { APP_CONSTANTS } from '@constants/app.constants';
import { Storage } from '@ionic/storage';
@Injectable({
providedIn: 'root'
})
export class StorageService {
private _storage: Storage | null = null;
@sweenzor
sweenzor / logtest.py
Created February 9, 2012 19:59
Writing to syslog with Python's logging library
import logging
import logging.handlers
log = logging.getLogger(__name__)
log.setLevel(logging.DEBUG)
handler = logging.handlers.SysLogHandler(address = '/dev/log')
formatter = logging.Formatter('%(module)s.%(funcName)s: %(message)s')
@JungeAlexander
JungeAlexander / import-package-from parent.py
Created November 27, 2014 17:22
Import modules from parent folder in Python
# From http://stackoverflow.com/a/11158224
# Solution A - If the script importing the module is in a package
from .. import mymodule
# Solution B - If the script importing the module is not in a package
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
@mogproject
mogproject / PythonUnitTestCheatSheet.md
Created July 24, 2015 11:17
Python unittest Cheat Sheet

Python unittest Cheat Sheet

Skeleton

@textarcana
textarcana / centos-install-syntax-highlighting-in-less.sh
Last active May 1, 2023 01:01
2020 update: just use bat(1) instead!!!! bat has git integration and also can show invisible characters! OLD STUFF: How to enable syntax-highlighting in less. Use `less -N` (or type -N while in less) to enable line numbers. Based on the procedure described in http://superuser.com/questions/71588
# Enable syntax-highlighting in less.
# Last tested on CentOS 6.3.
#
# First, add these two lines to ~/.bashrc
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
# export LESS=" -R "
sudo yum -y install boost boost-devel ctags
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm