Skip to content

Instantly share code, notes, and snippets.

View dallen66's full-sized avatar

Dandre Allen dallen66

View GitHub Profile
@dallen66
dallen66 / HowToOTGFast.md
Created December 19, 2021 05:02 — forked from gbaman/HowToOTGFast.md
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@dallen66
dallen66 / sigev_thread2.c
Created March 4, 2021 04:18 — forked from cirocosta/sigev_thread2.c
Posix Interval Timer example w/ threads
/*
* ORIGINAL HEADER
*
* sigev_thread.c
*
* Demonstrate use of the SIGEV_THREAD signal mode to handle
* signals by creating a new thread.
*
* Special notes: This program will not compile on Solaris 2.5.
* It will compile on Digital UNIX 4.0 but will not work.
@dallen66
dallen66 / unix_socket_datagram_stream_rust.md
Created February 8, 2021 06:04 — forked from gistub/unix_socket_datagram_stream_rust.md
Rust: Unix Domain Socket (bidirectional)

To create a bidirectional unix IPC:

  1. Server creates a sockets and binds it to an address (typically a file). Do NOT use connect as all send/recv operation will be done using connect's address!
  2. Client creates a socket and binds it to its own address. However the socket connects to the address of server.
  3. Server uses recv_from to get data from socket along side with the address of the client that sent the data. This way it can use the address to send a response back to client.

Example in Rust

server.rs

@dallen66
dallen66 / syscall2seccomp.py
Created January 8, 2021 04:12 — forked from chrisdlangton/syscall2seccomp.py
Automatically generate seccomp profile json by learning from container activity using sysdig
#!/usr/bin/env python3
import fileinput
import json
import argparse
SECCOMP_PROFILE = ('{"defaultAction": "SCMP_ACT_ERRNO",'
'"architectures": ['
'"SCMP_ARCH_X86_64",'
'"SCMP_ARCH_X86",'
--
-- PostgreSQL database dump
--
-- Dumped from database version 9.6.6
-- Dumped by pg_dump version 10.4 (Debian 10.4-2.pgdg90+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
CreateIndex({
  name: 'ngram_on_users',
  source: {
    collection: Collection('users'),
    fields: {
      search: Query(Lambda('instance', 
          Union(
            Union(Map([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], Lambda('min', NGram(LowerCase(Select(['data', 'first_name'], Var('instance'))), Var('min'), Var('min'))))),
 Union(Map([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], Lambda('min', NGram(LowerCase(Select(['data', 'last_name'], Var('instance'))), Var('min'), Var('min')))))
@dallen66
dallen66 / database-module.js
Created May 8, 2019 02:41 — forked from chl03ks/database-module.js
Auto-migrate and Auto-update Promise Module loopback
const app = require('../server');
const log = require('debug')('boot:automigrate');
const path = require('path');
const env = process.env.NODE_ENV;
let datasources = require(path.resolve(__dirname, '../datasources.production.json'));
let models = path.resolve(__dirname, '../model-config.production.json')
@dallen66
dallen66 / rownum.sql
Created November 17, 2018 02:41 — forked from tototoshi/rownum.sql
Grouped LIMIT in PostgreSQL: show the first N rows for each group
-- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group
-- http://www.postgresql.jp/document/9.2/html/tutorial-window.html
CREATE TABLE empsalary (
depname varchar(10) not null
, empno integer not null
, salary integer not null
);
INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200);
@dallen66
dallen66 / K8s-DigitalOcean-CoreOS.md
Created August 29, 2018 19:58 — forked from kevashcraft/K8s-DigitalOcean-CoreOS.md
How to Setup Kubernetes on DigitalOcean with CoreOS

Kubernetes on DigitalOcean with CoreOS

Let's look at an example of how to launch a Kubernetes cluster from scratch on DigitalOcean, including kubeadm, an Nginx Ingress controller, and Letsencrypt certificates.

Overview

Environment

We'll be creating a four-node cluster (k8s-master, k8s-000...k8s-002), load balancer, and ssl certificates.

Table of Contents

  1. Install Kubernetes
@dallen66
dallen66 / docker-compose.yml
Created August 28, 2018 04:29 — forked from mlabouardy/docker-compose.yml
Traefik example with Swarm mode
version: "3.3"
services:
traefik:
image: traefik:1.4
ports:
- 80:80
- 8080:8080
networks:
- traefik-net