Skip to content

Instantly share code, notes, and snippets.

type # concepts
BasicValue[T] = concept v
v.value is T
MinValue[T] = concept v
v is BasicValue[T]
v.min is T
MaxValue[T] = concept v
v is BasicValue[T]
v.max is T
@ovidiucs
ovidiucs / laterthiseveningcolor.txt
Created March 9, 2019 07:20
Later this evening color scheme
Name=Later This Evening
ColorForeground=#959595
ColorBackground=#222222
ColorCursor=#424242
ColorPalette=#2b2b2b;#d45a60;#afba67;#e5d289;#a0bad6;#c092d6;#91bfb7;#3c3d3d;
#454747;#d3232f;#aabb39;#e5be39;#6699d6;#ab53d6;#5fc0ae;#c1c2c2
@ovidiucs
ovidiucs / gist:14c21dc23d7b48cb0f763f4c2e2d2105
Last active June 22, 2019 18:14
lldb debug for while loop in hashing program
(lldb)
Process 27249 stopped
* thread #1, name = 't_hash', stop reason = step over
frame #0: 0x00005555555554bc t_hash`h_search(hTable=0x0000555555559260, key="400") at myhash.c:134:30
131 else {
132 // looking for the key inside the next element of the linked list
133 char* keyAtNextValue = hTable->h_items[resultHash]->h_next->h_key;
-> 134 while( nextValue->h_next != NULL) {
135 fprintf(stderr, "Found a collision, traversing Linked list at address %p, key is: %s",
136 nextValue, nextValue);
--- testdata_thash_output_sorted 2019-07-30 07:56:15.926762046 +0000
+++ testdata_original 2019-07-30 07:57:44.266766721 +0000
@@ -114,6 +114,7 @@
adapt-sna:1365/tcp
adcp:7508/tcp
adi-gxp-srvprt:6769/tcp
+admind:3279/tcp
admind:8403/tcp
admins-lms:2692/tcp
adobeserver-1:1102/tcp
--- testdata_original_delete 2019-07-30 12:14:25.430923889 +0000
+++ testdata_original 2019-07-30 12:13:13.064253409 +0000
@@ -561,6 +561,8 @@
ansanotify:116/tcp
mcidas:112/tcp
gppitnp:103/tcp
+mpm-flags:44/tcp
+smtp:25/tcp
nimbusdb:48004/tcp
jvl-mactalk:47100/udp
#!/usr/bin/env python3
import csv
import sys
import getopt
import regex
devices = []
newdevices = {}
def loadDevices(file):
{
"Standard Template": {
"prefix": "main",
"body": [
"#include <stdio.h>",
"",
"int main (int argc, char** argv) {",
"\t\t$0\n",
" return EXIT_SUCCESS;",
"}"
@ovidiucs
ovidiucs / define.c
Last active December 12, 2019 11:36
Define tricks
#define FAIL_IF(EXP) (\
{\
if(EXP) {\
exit(EXIT_FAILURE);\
}\
}\
)\
#define FAIL_IF_MSG(EXP,MSG) (\
{\
@ovidiucs
ovidiucs / source-template.c
Created December 15, 2019 12:57 — forked from peisenhower/source-template.c
C source file template. Code groupings and doxygen header.
/**
* @file [file name].c
* @authors [author]
* @copyright [copy write holder]
*
* @brief [description]
*/
/*******************************************************************************
* Includes
*******************************************************************************/
@ovidiucs
ovidiucs / min_swp.py
Last active January 12, 2020 10:58
min swap
def minimumSwaps(arr):
swp = 0
n = len(arr)
print(arr)
for i in range(1,n+1):
for j in range(n):
if(arr[arr.index(i)] == arr[j]):
source_idx = arr.index(i)
destination_idx = i-1
if source_idx != destination_idx: