Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View oleksiiBobko's full-sized avatar

Oleksii Bobko oleksiiBobko

  • Vinnytsia
View GitHub Profile
@oleksiiBobko
oleksiiBobko / tcp_server.c
Last active November 10, 2023 08:48
Simple socket server in C using threads (pthread library) Compiles on linux
/*
C socket server example, handles multiple clients using threads
Compile
gcc server.c -lpthread -o server
*/
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>
#remove all .orig files in a particular directory recursively
find . -name '*.orig' -delete
#rebase
git rebase -i HEAD~3
#undo commit and redo:
$ git commit -m "Something terribly misguided"
$ git reset HEAD~
#edit files as necessary
@oleksiiBobko
oleksiiBobko / draw.py
Last active October 23, 2022 20:37
Capture CPU utilization per core
import psutil
import time
import matplotlib.pyplot as plt
def start():
cpu_cores = psutil.cpu_count()
time_range = [i for i in range(60)]
cores = []
#!/usr/bin/env node
var fs = require("fs");
var http = require("https");
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
#!/usr/bin/env node
var http = require("http");
var server = http.createServer(function(request, response) {
console.log('-------------------------');
console.log(request.headers);
request.on('data', function(chunk) {
console.log("Received body data:");
console.log(chunk.toString());
syntax on
set nu
color koehler
filetype plugin indent on
set tabstop=4
set shiftwidth=4
set expandtab
set listchars=eol:¶,tab:->,trail:~,extends:>,precedes:<,space:·
set list
@oleksiiBobko
oleksiiBobko / dfg.js
Created July 5, 2016 09:43
js closure example
#!/usr/bin/env node
function celebrityIDCreator (theCelebrities) {
var i;
var uniqueID = 100;
for (i = 0; i < theCelebrities.length; i++) {
theCelebrities[i]["id"] = function (j) {
// the j parametric variable is the i passed in on invocation of this IIFE
return function () {
return uniqueID + j;
package x.y.z;
import java.util.HashMap;
import java.util.Map;
/**
* Hello world!
*
*/
public class App {