Skip to content

Instantly share code, notes, and snippets.

View shakahl's full-sized avatar
:electron:

Soma Szelpal shakahl

:electron:
  • Mastermind at Shakahl Ltd. • Used to made GitLab's AutoDevOps possible on GitHub Actios at getbridge.com • Did modern DevOps scale-ups at DiNG.hu • nextearth.io • omgmobile.hu • used to worked on Jasmin at Docler
  • Budapest, Hungary
  • LinkedIn in/somaszelpal
  • X @szelpalsoma
  • Facebook szelpalsoma
  • Instagram szelpalsoma
View GitHub Profile
@pguillory
pguillory / gist:729616
Created December 5, 2010 23:51
Hooking into Node.js stdout
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
write.apply(process.stdout, arguments)
callback(string, encoding, fd)
}
@paulsmith
paulsmith / echo.go
Created January 12, 2011 06:09
A simple echo server testing a few interesting Go language features, goroutines and channels.
// $ 6g echo.go && 6l -o echo echo.6
// $ ./echo
//
// ~ in another terminal ~
//
// $ nc localhost 3540
package main
import (
@revolunet
revolunet / lzw_encoder.js
Created February 25, 2011 14:55
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];
// This is what I think I have to do now:
cluster(http.createServer(requestCallback)).listen(80);
cluster(https.createServer(credentials, requestCallback)).listen(443);
// The above creates 2 clusters (2 x NumProcessors processes). What I'd like to do is have every
// process do a listenFD on the two ports, so in Cluster, maybe express it something like:
cluster([
http.createServer(requestCallback),
https.createServer(credentials, requestCallback)
]).listen([
@stefanfoulis
stefanfoulis / findauthors.sh
Created April 8, 2011 12:37
How to sync svn to git
#!/usr/bin/env bash
# Run this script inside a SVN checkout of the project
authors=$(svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2 }' | sort | uniq)
for author in ${authors}; do
echo "${author} = NAME <USER@DOMAIN>";
@greut
greut / run.php
Created April 30, 2011 18:18
A web server in pure PHP (non-concurrent and concurrent)
#!/usr/bin/env php
<?php
$app = function($request) {
$body = <<<EOS
<!DOCTYPE html>
<html>
<meta charset=utf-8>
<title>Hello World!</title>
@mtigas
mtigas / gist:952344
Last active October 16, 2024 09:03
Mini tutorial for configuring client-side SSL certificates.

Client-side SSL

For excessively paranoid client authentication.


Updated Apr 5 2019:

because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.

some other notes:

@bdunogier
bdunogier / curl_progress.php
Created June 16, 2011 22:31
PHP/cURL download progress monitoring
<?php
file_put_contents( 'progress.txt', '' );
$targetFile = fopen( 'testfile.iso', 'w' );
$ch = curl_init( 'http://ftp.free.org/mirrors/releases.ubuntu-fr.org/11.04/ubuntu-11.04-desktop-i386-fr.iso' );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt( $ch, CURLOPT_NOPROGRESS, false );
curl_setopt( $ch, CURLOPT_PROGRESSFUNCTION, 'progressCallback' );
curl_setopt( $ch, CURLOPT_FILE, $targetFile );
@gdamjan
gdamjan / rc.powersave
Created August 12, 2011 19:58
a script to enable powersaving options
#!/bin/sh
# A script to enable laptop power saving features for #! & Debian GNU+linux.
# http://crunchbanglinux.org/forums/topic/11954
# List of modules to unload, space seperated. Edit depending on your hardware and preferences.
modlist="nsc_ircc uhci_hcd"
# Bus list for runtime pm. Probably shouldn't touch this.
buslist="pci i2c"
case "$1" in
@kurokikaze
kurokikaze / removecomment.go
Created September 30, 2011 16:27
Remove comments from Go/C program (simple way)
package main
import bufio "bufio"
import fmt "fmt"
import os "os"
func main() {
var state = "0"
var cache = " "