Skip to content

Instantly share code, notes, and snippets.

View mihaisoloi's full-sized avatar

Mihai Soloi mihaisoloi

  • Bucharest, Romania
View GitHub Profile
@mihaisoloi
mihaisoloi / agregare.sh
Created June 1, 2012 21:36
Script for parsing csv table of contents and aggregating a number of pdfs with bookmarks using pdftk and gs
#!/bin/bash
files=""
options=""
title=""
pages=0
page_number=1
i=1
for f in TCST\ *.pdf
do
pages=$(pdfinfo "$f" | grep Pages | awk '{print $2}')
@mihaisoloi
mihaisoloi / screenrc
Created June 1, 2012 22:16
screen configuration file
#shell -${SHELL}
defscrollback 2024
startup_message off
#caption always "%{= kc}%H (system load: %l)%3n %t%? @%u%?%? %n(%t) %-21=%{= .m}%D %d.%m.%Y %0c"
hardstatus on
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%< %=%D %M %d %c"
#hardstatus string '%{= kc}(system load: %l) %-Lw%{= KW}%50>%n%f %t%{= kK}%+Lw%< %{=kc}%-= %-21=%{= .m}%D %d.%m.%Y %0c'
hardstatus string '%{= kG}(Load: %l) %-Lw%{=b .W}%50>%n%f* %t%{-}%+Lw%< %{=kG}%-= %-21=%{= .G}%D %Y.%m.%d %0c'
#hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
@mihaisoloi
mihaisoloi / gist:2855471
Created June 1, 2012 22:19
conky configuration file
# Use Xft?
use_xft yes
xftfont DejaVu Sans:size=8
xftalpha 0.8
text_buffer_size 2048
# Update interval in seconds
update_interval 1
# This is the number of times Conky will update before quitting.
@mihaisoloi
mihaisoloi / ws.html
Created November 6, 2013 08:57
Testing WS functionality
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function WebSocketTest()
{
if ("WebSocket" in window)
{
alert("WebSocket is supported by your Browser!");
// Let us open a web socket
package commons
import scala.concurrent.ExecutionContext
import akka.actor.ActorSystem
case class Contexts(val actorSystem: ActorSystem) {
import Contexts._
implicit val defaultCtx = DefaultExeCtx(play.api.libs.concurrent.Execution.defaultContext)
implicit val ctrlsCtx = CtrlExeCtx(defaultCtx.underlying)
@mihaisoloi
mihaisoloi / ProfilingMemoryUsageJVM.md
Created February 19, 2019 10:16 — forked from ljwagerfield/ProfilingMemoryUsageJVM.md
Profiling Memory Usage (JVM)

Profiling Memory Usage of a Method (JVM)

Prerequisites:

  • YourKit

Steps:

  1. Add Thread.sleep(60000) to the START and END of the method you want to profile.
import cats.effect.ExitCode
import monix.eval.{Task, TaskApp}
import monix.execution.Scheduler
import monix.execution.misc.Local
import cats.implicits._
import monix.execution.schedulers.TracingScheduler
import java.util.concurrent.{CompletableFuture, TimeUnit}
import scala.compat.java8.FutureConverters.toScala
object TaskLocalApp extends TaskApp {
@mihaisoloi
mihaisoloi / postgres_queries_and_commands.sql
Created September 24, 2019 14:53 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@mihaisoloi
mihaisoloi / docker-capture.sh
Created October 23, 2019 09:56
enters a network container, specified by the PID, captures everything on the interface eth0 on the container and exports it as a file
nsenter -n -t 2132 tcpdump -i eth0 -s 0 -A port 8000 -w capture.tcpdump