Skip to content

Instantly share code, notes, and snippets.

View land-pack's full-sized avatar
🤒
Out sick

Frank AK land-pack

🤒
Out sick
View GitHub Profile
@gbaman
gbaman / graphql_example.py
Created November 1, 2017 00:18
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@akabe
akabe / centos-zmq.sh
Created July 28, 2017 03:41
Install zeromq-devel on CentOS7
#!/bin/sh -xeu
sudo yum install -y epel-release
sudo yum install -y zeromq-devel
@miekg
miekg / udpserv.c
Created May 10, 2017 10:33
udp server in C
/*
* udpserver.c - A simple UDP echo server
* usage: udpserver <port>
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
@alexblom
alexblom / nginx
Last active August 8, 2019 03:13
Golang Websocket Nginx
#Golang Websocket Server
server {
listen 8080;
server_name wss.morse.io;
access_log /var/log/nginx/access_log.log;
error_log /var/log/nginx/error.log;
#ssl config
ssl on;
#Cert Info
@jniltinho
jniltinho / myip.go
Created March 26, 2014 16:55
Get My IP Golang
package main
/*
URL: https://github.com/mccoyst/myip/blob/master/myip.go
URL: http://changsijay.com/2013/07/28/golang-get-ip-address/
*/
import (
"net"
"os"
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active November 18, 2024 11:51
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@reterVision
reterVision / epoll_sample.c
Last active August 29, 2024 08:16
A sample program of how epoll works.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/epoll.h>
#include <errno.h>
@reterVision
reterVision / LRU.py
Last active March 1, 2023 02:32
LRU algorithm implemented in Python.
from datetime import datetime
class LRUCacheItem(object):
"""Data structure of items stored in cache"""
def __init__(self, key, item):
self.key = key
self.item = item
self.timestamp = datetime.now()