Skip to content

Instantly share code, notes, and snippets.

View CodyKochmann's full-sized avatar

Cody Kochmann CodyKochmann

  • Severn, MD
View GitHub Profile
@zmwangx
zmwangx / uuniq
Created July 1, 2014 18:16
Shell script: unsorted uniq via awk (uniq without sorting first).
#!/bin/bash
# remove duplicates without pre-sorting
# `uuniq' stands for unsorted uniq
awk '!x[$0]++'
@rust-play
rust-play / playground.rs
Created July 3, 2018 14:46
Code shared from the Rust Playground
pub struct Person{
age:i32,
gender: &'static str
}
impl Person{
fn render(&self){
println!( "___age : {}, __gender : {}",self.age, self.gender);
}
@jaybuidl
jaybuidl / scp-docker-data-volumes.sh
Created January 10, 2017 10:37
Copies all the local docker data volumes to a new machine via ssh
#/!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
@Elliottba
Elliottba / PY0101EN-3-4-Classes.ipynb
Created July 19, 2019 16:46
Created on Cognitive Class Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marcbachmann
marcbachmann / etc_docker_daemon.json
Created January 29, 2018 18:50
docker container logs using rsyslog & journald
{ "log-driver": "journald", "log-opts": {"tag": "{{.Name}}/{{.ID}}"}}
@grantslatton
grantslatton / hngen.py
Last active September 27, 2021 11:07
A program that uses Markov chains to generate probabilistic Hacker News titles.
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 March 10, 2022 09:29
Rsyslog queues

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

@bearfrieze
bearfrieze / comprehensions.md
Last active December 23, 2023 22:49
Comprehensions in Python the Jedi way

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.

@kasunbg
kasunbg / run-gui-apps-from-a-different-user.md
Created April 23, 2019 13:37
How to run a GUI application as a different user?

How to run a GUI application as a different user:

Suppose you are logged into your Linux box as user1 using some X window system already (with GNOME/Unity/..). Now you want to run some gui app as another user, user2.

Run:

  1. xhost + - Run as the user1. This enables access to user1's X window system from other users. You should see following output: 'access control disabled, clients can connect from any host'
  2. sudo su - user2 - Using your favorite terminal, log-in to second user.
  3. export DISPLAY=:0.0 - optional for some apps.
@jeanlescure
jeanlescure / README.md
Last active March 25, 2024 19:08
Ubuntu/Debian Offline Repository Creation

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