Skip to content

Instantly share code, notes, and snippets.

Avatar

Cody Kochmann CodyKochmann

  • Severn, MD
View GitHub Profile
@Elliottba
Elliottba / PY0101EN-3-4-Classes.ipynb
Created Jul 19, 2019
Created on Cognitive Class Labs
View PY0101EN-3-4-Classes.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rust-play
rust-play / playground.rs
Created Jul 3, 2018
Code shared from the Rust Playground
View playground.rs
pub struct Person{
age:i32,
gender: &'static str
}
impl Person{
fn render(&self){
println!( "___age : {}, __gender : {}",self.age, self.gender);
}
@marcbachmann
marcbachmann / etc_docker_daemon.json
Created Jan 29, 2018
docker container logs using rsyslog & journald
View etc_docker_daemon.json
{ "log-driver": "journald", "log-opts": {"tag": "{{.Name}}/{{.ID}}"}}
@jaybuidl
jaybuidl / scp-docker-data-volumes.sh
Created Jan 10, 2017
Copies all the local docker data volumes to a new machine via ssh
View scp-docker-data-volumes.sh
#/!bin/bash
[ $# -lt 1 ] && echo "usage: $(basename $0) <target_ssh_user@target_ssh_hostname>" && exit 1;
target="$1"
docker pull alpine
for volume in $(docker volume ls -q)
do
@bearfrieze
bearfrieze / comprehensions.md
Last active Aug 31, 2022
Comprehensions in Python the Jedi way
View comprehensions.md

Comprehensions in Python the Jedi way

by Bjørn Friese

Beautiful is better than ugly. Explicit is better than implicit.

-- The Zen of Python

I frequently deal with collections of things in the programs I write. Collections of droids, jedis, planets, lightsabers, starfighters, etc. When programming in Python, these collections of things are usually represented as lists, sets and dictionaries. Oftentimes, what I want to do with collections is to transform them in various ways. Comprehensions is a powerful syntax for doing just that. I use them extensively, and it's one of the things that keep me coming back to Python. Let me show you a few examples of the incredible usefulness of comprehensions.

@jeanlescure
jeanlescure / README.md
Last active Jan 13, 2023
Ubuntu/Debian Offline Repository Creation
View README.md

Ubuntu/Debian Offline Repository Creation Gist

When I googled how to create my own offline repository of packages for use in an offline Ubuntu/Debian machine, the results were disheartening and the steps to be taken scattered all over the place.

The files within this gist will allow you to:

  • Download specific apt-get packages... with dependencies included!
  • Create a Packages.gz file so that you can add the repository folder you create to the target machine's /etc/apt/sources.list file.

Before using

View useful_pandas_snippets.md

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@zmwangx
zmwangx / uuniq
Created Jul 1, 2014
Shell script: unsorted uniq via awk (uniq without sorting first).
View uuniq
#!/bin/bash
# remove duplicates without pre-sorting
# `uuniq' stands for unsorted uniq
awk '!x[$0]++'
@grantslatton
grantslatton / hngen.py
Last active Sep 27, 2021
A program that uses Markov chains to generate probabilistic Hacker News titles.
View hngen.py
import urllib2
import re
import sys
from collections import defaultdict
from random import random
"""
PLEASE DO NOT RUN THIS QUOTED CODE FOR THE SAKE OF daemonology's SERVER, IT IS
NOT MY SERVER AND I FEEL BAD FOR ABUSING IT. JUST GET THE RESULTS OF THE
CRAWL HERE: http://pastebin.com/raw.php?i=nqpsnTtW AND SAVE THEM TO "archive.txt"
@esfand
esfand / rsyslogque.md
Last active Mar 10, 2022
Rsyslog queues
View rsyslogque.md

Main Queue

This object is available since 7.5.3. It permits to specify parameters for the main message queue. Note that only queue-parameters are permitted for this config object. This permits to set the same options like in ruleset and action queues. A special statement is needed for the main queue, because it is a different object and cannot be configured via any other object.

Note that when the main_queue() object is configured, the legacy $MainMsgQ... statements are ignored.

A Simple Example

main_queue(    
    queue.size="100000"      # how many messages (messages, not bytes!) to hold in memory

queue.type="LinkedList" # allocate memory dynamically for the queue. Better for handling spikes