Skip to content

Instantly share code, notes, and snippets.

View valeriansaliou's full-sized avatar

Valerian Saliou valeriansaliou

View GitHub Profile
@scvalex
scvalex / Warshall.hs
Created May 4, 2010 21:00
Floyd-Warshall in 2 lines of Haskell
module Warshall where
import Data.Char ( isAlpha )
import Data.List ( nub, sort )
import System.Environment ( getArgs )
import Text.Parsec
import Text.Parsec.String
import Text.Printf ( printf )
type Vertex a = a
@komamitsu
komamitsu / AndroidManifext.xml
Created February 23, 2012 15:52
Android Simple web server using NanoHTTPD (http://elonen.iki.fi/code/nanohttpd)
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
#!/usr/bin/env ruby
require 'net/telnet'
prefix = ARGV.length > 1 ? ARGV[1] : nil
prefix_regexp = prefix && Regexp.new("\A#{prefix}")
cache_dump_limit = 100
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
slab_ids = []
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c|
@llaine
llaine / scriptI.sh
Last active November 5, 2018 22:58
An algorithm which will automatically visit profiles on a dating site. In particular in adopteunmec.com. This algorithm has been written in bash.
#!/bin/bash
# @contact: darksioul6@gmail.com
# Enjoy
if [[ ! -e "config" ]]; then
echo "Entrez les informations correspondantes : "
echo -ne "Username : " ; read -r u
echo -ne "Mot de passe : " ; read -r p
echo -ne "L'age minimum : " ; read -r amin
echo -ne "L'age maximum : " ; read -r amax
@bluesmoon
bluesmoon / README.md
Last active February 15, 2022 12:43
Pseudo-Random number generator that follows a Normal or Log-Normal distribution.

Marsaglia-polar.js

This script generates random numbers along a Normal or Log-normal distribution using the Marsaglia polar method.

There are four functions you can use:

  • normalRandom: Generate random numbers that follow a Normal distribution.
  • normalRandomInRange: Generate random numbers that follow a Normal distribution but are clipped to fit within a range
  • normalRandomScaled: Generate random numbers that follow a Normal distribution with a given mean and standard deviation
  • lnRandomScaled: Generate random numbers that follow a Log-normal distribution with a given geometric mean and geometric standard deviation
@MattSurabian
MattSurabian / redis-one-line--pattern-delete.sh
Last active November 14, 2018 17:52
One liner for deleting based on a pattern in redis. KEYS supports wildcards, delete doesn't. No worries xargs to the rescue. You might not need HOST, or PORT depending on your setup. You might need to sudo BOTH commands depending on your setup.
redis-cli -h <HOST> -p <PORT> KEYS "<PATTERN>" | xargs -i% redis-cli -h <HOST> -p <PORT> DEL %
@olitreadwell
olitreadwell / entêtement.md
Last active November 27, 2015 14:06
entêtement at École 42

Workstations at École 42 photo credit (MARION SOLLETTY / FRANCETV INFO)

Paris' École 42 demonstrates an essential character trait of any would-be developer.

Stubbornness.

Call it determination, call it perseverance, it remains as the ability to continue working at a problem.

I allude to this experience as banging my head against the wall.

// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@glen-cheney
glen-cheney / encoding-video.md
Last active August 19, 2026 07:56
Encoding video for the web

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@sid24rane
sid24rane / net.js
Last active February 6, 2026 03:39
Simple TCP Client and Server in Node.js (Covering all useful Properties & Methods)
var net = require('net');
// creates the server
var server = net.createServer();
//emitted when server closes ...not emitted until all connections closes.
server.on('close',function(){
console.log('Server closed !');
});