Skip to content

Instantly share code, notes, and snippets.

View kopos's full-sized avatar
🎯
Focusing

Poorna Shashank kopos

🎯
Focusing
View GitHub Profile
@kopos
kopos / mydckr.go
Last active February 20, 2022 14:21
Building a container from scratch in Go
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
// docker run <container> cmd args
@kopos
kopos / README.txt
Created November 21, 2021 07:58
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
REMIX EXAMPLE PROJECT
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer.
It contains 3 directories:
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name.
2. 'scripts': Holds two scripts to deploy a contract. It is explained below.
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity.
SCRIPTS
@kopos
kopos / round.clj
Created February 11, 2021 04:01
Clojure rounding
(bigdec 5)
(* (bigdec 5) 2)
(* 3 (bigdec 5))
(* (bigdec 5) 0.2)
(* (bigdec 5) (bigdec 6))
@kopos
kopos / python3_mro_inheritance.py
Created January 6, 2021 17:50
Python3 Inheritance MRO
Output
@kopos
kopos / unified.clj
Created September 16, 2019 09:22
Unified URL management to respond to GET, POST & Websocket
; deps
;
; [org.clojure/clojure "1.10.0"]
; [http-kit "2.3.0"]
; [ring "1.7.1"]
; [compojure "1.6.1"]
(ns unified.core
(:require
[ring.middleware.params :refer [wrap-params]]
(def ^:const KARPEKAR 6174)
(defn ->number [ds]
(reduce (fn [n d] (+ d (* n 10))) ds))
(defn ->digits [n]
(loop [N n
ds []]
(if (= (count ds) 4)
ds
@kopos
kopos / randomslug.clj
Created August 21, 2019 11:44
Generate alphanumeric random strings of fixed length (starting with one of the 26 letters of the alphabet and rest alnums)
(defn ->letters [s]
(clojure.string/split s #""))
(def first-letter-alphabet
(->letters "qwertyuiopasdfghjklzxcvbnm"))
(def alphabet
(->letters "qwertyuiopasdfghjklzxcvbnm1234567890"))
(defn uid [n]
@kopos
kopos / hello_using.exs
Created April 24, 2018 07:00
Small script to understand usage of __using__ / $ elixirc hello_using.exs
defmodule MyModule do
defmacro __using__(_) do
┆ quote do
┆ ┆ import MyModule
┆ ┆ def hi(s) do
┆ ┆ ┆ IO.puts "Hi #{s} from #{__MODULE__}"
┆ ┆ end
┆ end
end
@kopos
kopos / stack.ex
Created November 28, 2017 06:27
Stack module using receive loop, GenServer and Agent
defmodule Stack0 do
@moduledoc "
Stack module using the receive loop
iex> {:ok, pid} = Stack0.start_link([:a, :b])
{:ok, #PID<0.107.0>}
iex> Process.register pid, :stack0
true
import frida, sys
native_hook_code = """
Java.perform(function() {
Privilege = Java.user("com.android.engineeringmode.qualcomm.Privilege");
Privilege.escalate.implementation = function(v) {
console.log('escalate Done: ');
return true;
};