Skip to content

Instantly share code, notes, and snippets.

@visar
visar / replace-debian-with-arch.txt
Created February 9, 2016 12:53 — forked from m-ou-se/replace-debian-with-arch.txt
Instructions to replace a live Debian installation with Arch
# Download latest archlinux bootstrap package, see https://www.archlinux.org/download/
wget http://ftp.nluug.nl/os/Linux/distr/archlinux/iso/2016.01.01/archlinux-bootstrap-2016.01.01-x86_64.tar.gz
# Make sure you'll have enough entropy for pacman-key later.
apt-get install haveged
# Install the arch bootstrap image in a tmpfs.
mount -t tmpfs none /mnt
cd /mnt
tar xvf ~/archlinux-bootstrap-2016.01.01-x86_64.tar.gz --strip-components=1
@visar
visar / file-share-linux.md
Created March 2, 2016 12:16 — forked from whoeverest/file-share-linux.md
How to make a personal file upload server

Simple file sharing, with Nginx and scp

This is a tutorial that teaches you how to create your own simple file-sharing service. It works in the terminal.

Usage:

$ share ~/pictures/my-funny-kitten.png
http://files.YOURDOMAIN.com/my-funny-kitten.png
@visar
visar / check-ssl-expiry.sh
Created March 3, 2016 10:15 — forked from gdamjan/check-ssl-expiry.sh
cgi bin script to check ssl domains for expiry - https://damjan.softver.org.mk/cgi-bin/ssl.sh
#!/bin/bash
set -x
WARNDAYS=30
PANICDAYS=6
DOMAIN_LIST_URL=https://raw.githubusercontent.com/skopjehacklab/dns-zone-files/master/ssl/list_of_ssl_enabled_domains.txt
WARNSECONDS=$(($WARNDAYS * 24 * 60 * 60))
PANICSECONDS=$(($PANICDAYS * 24 * 60 * 60))
@visar
visar / lcap.c
Created March 7, 2016 10:43 — forked from sbz/lcap.c
example of using linux capabilities interface libcap(3) and dump capabilities flags for the running process
#include <sys/capability.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int
main(void) {
pid_t pid;
cap_t cap;
urls = ["http://www.google.com", "http://www.bing.com", "http://www.yahoo.com"]
for_tasks = for {url, i} <- Enum.with_index(urls) do
Task.async(fn ->
:timer.sleep(3000 * i)
IO.puts("for ##{i}: #{url}")
end)
end
map_tasks = urls
@visar
visar / beezid_scraper.py
Created August 22, 2016 12:06 — forked from CuriousGnu/beezid_scraper.py
Beezid.com - Auction Scraper
import pycurl
import json
import time
from StringIO import StringIO
i = 0
bnums = []
while True :
print(str(i))
@visar
visar / latency.markdown
Created October 9, 2016 07:14 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@visar
visar / README.md
Created November 15, 2016 11:53 — forked from gdamjan/README.md
Gtalk ⇄ xmpp gateway - learning contest!

Gtalk ⇄ xmpp gateway

Do it in any language you want to learn. The prize is knowledge!

Some of the more interesting would be Erlang, Elixir, Lua, Rust, Go, Haskell, Ocaml, but also anything more exotic than theese (OTOH an PHP version would be really crazy exotic for this kind of an app).

Connects to gtalk as an xmpp or hangouts (protobufs) client. Connects to my prosody as an xmpp component and forwards messages to my one single account.

@visar
visar / map_difference.ex
Created September 28, 2017 07:59 — forked from boydm/map_difference.ex
Elixir meyers_difference for Maps
defmodule Boydm.Utilities.Map do
#============================================================================
# similar to List.meyers_difference, the below code compares two maps
# and generates a list of actions that can be applied to the first map
# to transform it into the second map.
#--------------------------------------------------------
def difference(map_1, map_2) when is_map(map_1) and is_map(map_2) do
# remove any keys from map_1 that are simply not present (at all) in map_2
@visar
visar / .travis.yml
Created December 6, 2017 11:19 — forked from b1ackmartian/.travis.yml
Travis CI Gigalixir Deploy
language: elixir
elixir: 1.5.2
otp_release: '19.0'
script:
- mix test && ./deploy.sh