Skip to content

Instantly share code, notes, and snippets.


Nyaundi Brian danleyb2

View GitHub Profile
danleyb2 / unixhttpc.go
Created Nov 14, 2020 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
View unixhttpc.go
package main
import (
laobubu /
Last active Apr 10, 2020
njq (No jQuery) use vanilla DOM API with jQuery-like functions.

njq (No jQuery)

Vanilla JavaScript is good but the function names are too long. Now, you can use vanilla DOM API with jQuery-like functions.

Only ~1kB (without gzip) after uglifying. You can even tailor for yourself to make it much smaller, by deleting/adding modules. A good choice to manipulate DOM for side projects.


kekru / 1-Enable Docker Remote API with TLS client
Last active Apr 23, 2021
Docker Remote API with client verification via daemon.json
View 1-Enable Docker Remote API with TLS client

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

EvieePy /
Last active May 11, 2021
A Cogs Example for the rewrite version of -
import discord
from discord.ext import commands
import sys, traceback
"""This is a multi file example showcasing many features of the command extension and the use of cogs.
These are examples only and are not intended to be used as a fully functioning bot. Rather they should give you a basic
understanding and platform for creating your own bot.
These examples make use of Python 3.6.2 and the rewrite version on the lib.
mikecrittenden /
Last active May 15, 2021
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains --no-parent
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
Runnable r1 = new Runnable() {
public void run() {
System.out.println("My Runnable");
Runnable r2 = () -> System.out.println("My Runnable");
laobubu /
Last active May 13, 2021
A very simple HTTP server in C, for Unix, using fork()

Pico HTTP Server in C

This is a very simple HTTP server for Unix, using fork(). It's very easy to use

How to use

  1. include header httpd.h
  2. write your route method, handling requests.
  3. call serve_forever("12913") to start serving on port 12913
bradmontgomery /
Created Aug 16, 2016
Example of setting a choices value for django ArrayField
# Here's your list of choices that would be displayed in a drop-down
# element on the web. It needs to be a tuple, and we define this
# as a variable just for readability/convenience.
# This example has 3 choices, each of which consists of two parts:
# 1. the thing that get strored in your database
# 2. the thing that you see in a dropdown list
('this gets stored in your database', 'This item is what you see in the drop-down'),
('django', 'Django'),
danleyb2 / scratch_2
Created Jan 17, 2016
load Link header into a dictionary
View scratch_2
#!/usr/bin/env python3.4
#### Nyaundi Brian <>
from pprint import pprint
links_string_from_header='<>; rel="next",' \
' <>; rel="last", ' \
'<>; rel="first", ' \
'<>; rel="prev"'
package anim;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.imageio.ImageIO;
import javax.swing.JFrame;