Skip to content

Instantly share code, notes, and snippets.

View Rizary's full-sized avatar

Andika Demas Riyandi Rizary

View GitHub Profile
@Rizary
Rizary / dockertosmth.rs
Last active September 18, 2020 12:46
trying to create an async function in Rust
async fn docker_json_to_smth(arg: (Docker, &ContainerSummary)) -> () {
let (docker, csummary) = arg;
let container = docker
.inspect_container(
csummary.id.as_ref().unwrap(),
None::<InspectContainerOptions>,
)
.await
.unwrap();
$remoteport = bash.exe -c "ip a | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport=$remoteport.Split("inet");
foreach ($rp in $remoteport) {
if ($rp -match '172.\d{1,3}\.\d{1,3}\.\d{1,3}') {
$remoteport=$rp;
$remoteport=$remoteport.Split("/");
{ jupyterWith
, haskellPackages
, haskellPkg ? (_: [])
, pythonPkg ? (_: [])
, pythonOverridesList ? []
}:
let
jupyterSrc = jupyterWith + "/nix";
inherit (import jupyterSrc {}) pkgs lib;
@Rizary
Rizary / dsl.hs
Last active December 6, 2019 07:18
dsl london
import DB (dbTable, dbMap, dbFilter, runExpr)
import Prelude (error)
type FirstName = String
type LastName = String
type Age = Int
type City = String
data Row = Row FirstName LastName Age City
newPkgs: oldPkgs:
with oldPkgs;
let
noCheck = p: haskell.lib.dontCheck p;
noHaddock = p: haskell.lib.dontHaddock p;
fast = p: noHaddock (noCheck p);
static = p: haskell.lib.justStaticExecutables (fast p);
in {
# All haskellPackages
routeLink True r w = do
let cfg = (def :: ElementConfig EventResult t (DomBuilderSpace m))
& elementConfig_eventSpec %~ addEventSpecFlags (Proxy :: Proxy (DomBuilderSpace m)) Click (\_ -> preventDefault)
& elementConfig_initialAttributes .~ "href" =: r
(e, a) <- element "a" cfg w
setRoute $ (switchPkgRoute (Just $ decodeFrag r)) <$ domEvent Click e
return a
routeLink False r w = do
let cfg = (def :: ElementConfig EventResult t (DomBuilderSpace m))
& elementConfig_initialAttributes .~ "href" =: r
@Rizary
Rizary / GSoC'19.md
Last active August 25, 2019 00:29
This is my summary for GSoC 2019

Describe my work briefly

  • Adding tags and search box feature to existing UI v3 code
  • Remove the use of dyn function for routing case
  • Add dropdown and address bar routing
  • Expanding Type API and removing MonadWidget constraint
  • Adding content in home page
  • Adding Luite's diff link to matrix table

What is done

_ <- mdo
historyState <- manageHistory $ HistoryCommand_PushState <$> setState
let
f (currentSet, currentHistoryState, oldRoute) idxChange =
let newRoute = switchPkgRoute currentSet oldRoute idxChange
in
HistoryStateUpdate
{ _historyStateUpdate_state = DOM.SerializedScriptValue jsNull
, _historyStateUpdate_title = ""
, _historyStateUpdate_uri = newRoute
deepNested :: forall a. Event t a
n1 <- ...
...
...
n2 <- ...
...
...
n3 <- ...
...
...
window <- DOM.currentWindowUnchecked
history <- Window.getHistory window
location <- Window.getLocation window
oldUri <- (decodeFrag . T.pack . uriFragment) <$> getLocationUri location
backState <- wrapDomEvent window (`DOM.on` DOM.popState) $ do
e <- DOM.event
jV <- PopStateEvent.getState e
oUri <- liftJSM $ fromJSVal jV
pure $ decodeFrag $ fromMaybe (T.pack "") oUri
setState <- performEvent $ attachWith (switchRoutingState' history) (current route) changeStateE