Skip to content

Instantly share code, notes, and snippets.

View oktomus's full-sized avatar

Kevin Masson oktomus

View GitHub Profile
@oktomus
oktomus / insertSort.sh
Created December 13, 2015 11:28
Sort an array while inserting by ascending order in bash
read N
read tab[0]
for (( i=1; i<N; i++ )); do
read x
j=0
k=$i
while [ $k -gt $j ]
do
m=$((($j+$k)/2))
if [ $x -lt ${tab[$m]} ]; then
@oktomus
oktomus / Time.php
Created February 26, 2016 10:11
Calculate the reponse time of your webpage, useful to check SQL request time.
<?php
namespace app;
class Time
{
private $startTime, $reponseTime;
public function __construct(){
$this->startTime = microtime(true);
@oktomus
oktomus / Huffman.java
Last active February 12, 2017 11:32
Huffman compression in JAVA
import java.io.*;
import java.util.*;
public class Huffman{
/**
* Représente un noeud pour un arbre binaire
*
* Peut avoir une valeur, un nombre d'occurence, un fils gauche et un fils droit
@oktomus
oktomus / Makefile
Created February 12, 2017 11:31
Makefile : executable for each source file
CXX=g++
FLAGS=-Wall
LFLAGS=-lglut -lGL -lGLU
SRC=.
EXEC=.
SRCS=$(wildcard $(SRC)/*.cpp)
EXECS=$(SRCS:$(SRC)/%.cpp=$(EXEC)/%.out)
@oktomus
oktomus / index.html
Last active March 12, 2017 21:36
Web JS Perlin noise
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" src="main.js"></script>
<style type="text/css">
html, body {
margin: 0px;
}
#!/usr/bin/python
"""
Set a red alarm on a given light when the specified website is down
"""
import os
from phue import Bridge
from time import sleep
@oktomus
oktomus / kmean.py
Created November 18, 2017 20:34
Python kmean implementation
#!/usr/bin/python
# Kmean on a CSV data set
# 2016
import sys
import csv
if len(sys.argv) < 2:
print "USAGE : %s csv-file" % (sys.argv[0])
@oktomus
oktomus / regex.txt
Last active November 23, 2017 20:59
Usefull regex
Duik translation files
-----------------------
DutranslatorArray.push(["Duik - Loading icons",0,"Duik - Chargement des icônes"]);
\\"([^\\"\\](?:\\.[^\\"\\])?)\\" , (\\d) , \\"([^\\"\\](?:\\.[^\\"\\])?)\\" ]\); (?:\/\/(.))*
Capture les 3 ou + paramètres entre ([ et )]
Dutranslator.languages.push(['fr','Français']);
'([^\\\\\\*\\.\\s/]+)','([^\\\\\\*\\.\\s/]+)'
Capture le code et le language name
@oktomus
oktomus / Makefile
Created December 14, 2018 14:58
GameBoy Hello World
GB_NAME := hello_world
all: $(GB_NAME).gb
$(GB_NAME).gb: $(GB_NAME).o
rgblink -o $@ $<
rgbfix -v -p 0 $@
$(GB_NAME).o: $(GB_NAME).ds
rgbasm -o $@ $<
@oktomus
oktomus / fork-custom-commands.md
Last active January 30, 2024 22:52
Fork custom commands

With custom commands, you are one shortcut away to run commands thanks to the Quick Launch (Ctrl+P, ⌘+P).

Custom commands can be configured in File > Preferences > Custom commands, or by editing the json file custom-commands.json located in AppData/Local/Fork on Windows and ~/Library/Application Support/com.DanPristupov.Fork/custom-commands.json on MacOS.

Please share your own custom commands :)

How to use

Fork commands are posted as comments on this gist. Press CTRL+F to search for commands.