Skip to content

Instantly share code, notes, and snippets.

View sakishum's full-sized avatar
🎯
Focusing

Sakishum sakishum

🎯
Focusing
View GitHub Profile
@sakishum
sakishum / redis_connection_string.go
Created July 3, 2022 06:16 — forked from peterhellberg/redis_connection_string.go
Parsing a Redis connection string for use with go-workers
package main
import (
"fmt"
"net/url"
"strings"
)
func main() {
s := "redis://username:password@my.host:6389/4?pool=25&process=2"
@sakishum
sakishum / rsyncprogress.py
Created March 7, 2019 02:30 — forked from JohannesBuchner/rsyncprogress.py
Progress bar for rsync
"""
Progress bar for rsync
========================
Shows file progress and total progress as a progress bar.
Usage
---------
Run rsync with -P and pipe into this program. Example::
@sakishum
sakishum / mongo-docker.bash
Created January 12, 2019 09:02 — forked from davideicardi/mongo-docker.bash
Running mongodb inside a docker container (with mongodb authentication)
# Create a container from the mongo image,
# run is as a daemon (-d), expose the port 27017 (-p),
# set it to auto start (--restart)
# and with mongo authentication (--auth)
# Image used is https://hub.docker.com/_/mongo/
docker pull mongo
docker run --name YOURCONTAINERNAME --restart=always -d -p 27017:27017 mongo mongod --auth
# Using the mongo "localhost exception" (https://docs.mongodb.org/v3.0/core/security-users/#localhost-exception)
# add a root user
@sakishum
sakishum / Makefile
Created March 30, 2018 02:43 — forked from huxuan/Makefile
Hello World for LuaJIT FFI/C++ binding.
all: lib run
lib:
g++ -shared -fPIC -o libhello.so libhello.cpp hello.cpp
run:
luajit main.lua
clean:
rm *.so
@sakishum
sakishum / install_spark_centos7.sh
Created March 11, 2018 13:40 — forked from darcyliu/install_spark_centos7.sh
Install Spark on CentOS 7
#!/bin/bash
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
wget http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz
tar xvf scala-2.11.7.tgz
sudo mv scala-2.11.7 /usr/lib
sudo ln -s /usr/lib/scala-2.11.7 /usr/lib/scala
@sakishum
sakishum / test.sh
Created August 22, 2017 01:40 — forked from arq5x/test.sh
Compress and then Decompress a string with zlib.
# compile
$ g++ zlib-example.cpp -lz -o zlib-example
# run
$ ./zlib-example
Uncompressed size is: 36
Uncompressed string is: Hello Hello Hello Hello Hello Hello!
----------
@sakishum
sakishum / Vector.lua
Created September 7, 2013 08:33 — forked from mebens/Vector.lua
Vector = {}
Vector.__index = Vector
function Vector.__add(a, b)
if type(a) == "number" then
return Vector.new(b.x + a, b.y + a)
elseif type(b) == "number" then
return Vector.new(a.x + b, a.y + b)
else
return Vector.new(a.x + b.x, a.y + b.y)
@sakishum
sakishum / Makefile
Created August 3, 2013 02:23 — forked from utaal/Makefile
webserver: webserver.c libuv/uv.a http-parser/http_parser.o
gcc -I libuv/include \
-lrt -lm -lpthread -o \
webserver webserver.c \
libuv/uv.a http-parser/http_parser.o
libuv/uv.a:
$(MAKE) -C libuv
http-parser/http_parser.o:
-module(problem20).
-include("euler.hrl").
answer() -> lists:sum(i2d(fact(100))).
fact(0) -> 1;
fact(N) -> N * fact(N-1).
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <curl/curl.h>
#define MAX_JOBS 10
//
// Released into the public domain.