Skip to content

Instantly share code, notes, and snippets.

View muradm's full-sized avatar
💭
Use as intended

Murad muradm

💭
Use as intended
View GitHub Profile
@muradm
muradm / gpg-agent.scm
Created March 1, 2021 17:46
gpg-agent.scm
(use-modules (ice-9 format) (ice-9 popen) (ice-9 rdelim) (ice-9 regex)
((guix packages) #:select (package-file))
((guix store) #:select (open-connection close-connection run-with-store))
((gnu packages gnupg) #:select (gnupg pinentry-emacs)))
(define current-tty (ttyname (current-output-port)))
(define gpg-agent-description
(format #f "GnuPG PGP and SSH agent on ~a" current-tty))
@muradm
muradm / shepherd
Created March 1, 2021 17:41
shepherd starter script
#!/usr/bin/env -S guix repl --
!#
;; dynamic version of /gnu/store/....-shepherd-.../bin/shepherd
;; here we want to run shepherd with guix guile, in order
;; to be able to use (use-modules (guix ...)) in our scripts
;;
;; Why: currently guix runs with guile-3.0.5, while stock
;; shepherd is provided with guile-3.0.2. When importing modules
;; guix, it gives tones of "bytecode incompatible" warnings
@muradm
muradm / grub-latest.scm
Last active February 28, 2021 19:05
grub-latest.scm
(define-module (grub-latest)
#:use-module (guix build-system gnu)
#:use-module (guix build-system trivial)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
@muradm
muradm / polyfill.ts
Created January 24, 2020 21:30
Angular polyfill.ts for remote console log
import 'zone.js/dist/zone' // Angular requirement
(window as any).enableRemoteLog = () => {
(window as any).originalConsole = console
const axios = import('axios')
console = (Object.keys(console) as (keyof Console)[])
.map(k =>
typeof console[k] === 'function'
? {
[k]: (...args: any[]) => {
@muradm
muradm / angular-schema-link.ts
Created January 23, 2020 14:10
Angular SchemaLink
@muradm
muradm / mongodb+3.1.12.patch
Created January 17, 2019 09:38
node mongodb patch to avoid makeLazyLoader
patch-package
--- a/node_modules/mongodb/lib/operations/collection_ops.js
+++ b/node_modules/mongodb/lib/operations/collection_ops.js
@@ -18,13 +18,12 @@ const handleCallback = require('../utils').handleCallback;
const indexInformationDb = require('./db_ops').indexInformation;
const isObject = require('../utils').isObject;
const Long = require('mongodb-core').BSON.Long;
-const makeLazyLoader = require('../utils').makeLazyLoader;
const MongoError = require('mongodb-core').MongoError;
const ReadPreference = require('mongodb-core').ReadPreference;
@muradm
muradm / Graph.scala
Last active December 17, 2018 04:14
Graph.scala
// https://github.com/asarkar/algorithms-design-analysis-2/blob/master/data-structures/src/main/scala/org/asarkar/data/Graph.scala
import scala.collection.immutable.{HashMap, Set}
sealed trait Edge[T] {
def tail: T
def head: T
}
sealed trait WeightedEdge[T] extends Edge[T] {
@muradm
muradm / IntelliJ_IDEA__Perf_Tuning.txt
Last active July 28, 2018 17:31 — forked from P7h/IntelliJ_IDEA__Perf_Tuning.txt
Performance tuning parameters for IntelliJ IDEA. Add these params in idea64.exe.vmoptions or idea.exe.vmoptions file in IntelliJ IDEA. If you are using JDK 8.x, please knock off PermSize and MaxPermSize parameters from the tuning configuration.
-server
-Xms2048m
-Xmx2048m
-XX:NewSize=512m
-XX:MaxNewSize=512m
-XX:PermSize=512m
-XX:MaxPermSize=512m
-XX:+UseParNewGC
-XX:ParallelGCThreads=4
-XX:MaxTenuringThreshold=1
@muradm
muradm / TestCop1.scala
Created June 27, 2018 08:40
Multi type type-class
import shapeless.{:+:, CNil, Coproduct, Generic, Lazy}
object TestCop1 extends App {
sealed trait MyState
case class MyState1() extends MyState
// case class MyState2() extends MyState
// case class MyState3() extends MyState
sealed trait MyEvent